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

This commit is contained in:
Matthias Klose 2010-03-19 14:45:06 +00:00
parent f4fd0bf7c1
commit e9fbf2b943
3 changed files with 10 additions and 0 deletions

View File

@ -505,6 +505,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")

View File

@ -63,6 +63,8 @@ Library
Extension Modules
-----------------
- Issue #1039, #8154: Fix os.execlp() crash with missing 2nd argument.
- Issue #6949: Allow the _bsddb extension to be built with db-4.8.x.
- Issue #8142: Update libffi to the 3.0.9 release.

View File

@ -2952,6 +2952,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) {