]> granicus.if.org Git - python/commitdiff
Merged revisions 79096 via svnmerge from
authorMatthias Klose <doko@ubuntu.com>
Sat, 20 Mar 2010 02:13:49 +0000 (02:13 +0000)
committerMatthias Klose <doko@ubuntu.com>
Sat, 20 Mar 2010 02:13:49 +0000 (02:13 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79096 | matthias.klose | 2010-03-19 15:45:06 +0100 (Fr, 19 Mär 2010) | 2 lines

  - Issue #1039, #8154: Fix os.execlp() crash with missing 2nd argument.
........

Lib/test/test_os.py
Misc/NEWS
Modules/posixmodule.c

index 3cb411beff84fd6868d66d708003e55a1157f72d..45f6bd20ee094afcd2eb58ec86b08270bc416010 100644 (file)
@@ -511,6 +511,9 @@ class URandomTests (unittest.TestCase):
         except NotImplementedError:
             pass
 
+    def test_execvpe_with_bad_arglist(self):
+        self.assertRaises(ValueError, os.execvpe, 'notepad', [], None)
+
 class Win32ErrorTests(unittest.TestCase):
     def test_rename(self):
         self.assertRaises(WindowsError, os.rename, test_support.TESTFN, test_support.TESTFN+".bak")
index 1fbf7c1cfbce11885ca55a13b56a943057be210f..9fd5f0887a52838fac9e6afb6e0dd9c50b46b96f 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #1039, #8154: Fix os.execlp() crash with missing 2nd argument.
+
 - Issue #4961: Inconsistent/wrong result of askyesno function in tkMessageBox
   with Tcl/Tk-8.5.
 
index 2ed54e4bdbcfa2a2bd058a8880ec359b29bef1e2..5add8481b8b098fd3ae86054712cee71121e8d1f 100644 (file)
@@ -2979,6 +2979,11 @@ posix_execv(PyObject *self, PyObject *args)
                 PyMem_Free(path);
                return NULL;
        }
+       if (argc < 1) {
+               PyErr_SetString(PyExc_ValueError, "execv() arg 2 must not be empty");
+                PyMem_Free(path);
+               return NULL;
+       }
 
        argvlist = PyMem_NEW(char *, argc+1);
        if (argvlist == NULL) {