mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Forbid an empty argument list in execv call.
Fixes issue 1039.
This commit is contained in:
parent
8a7c866e18
commit
6790d606ff
2 changed files with 8 additions and 0 deletions
|
@ -441,6 +441,9 @@ class ExecTests(unittest.TestCase):
|
|||
def test_execvpe_with_bad_program(self):
|
||||
self.assertRaises(OSError, os.execvpe, 'no such app-', [], None)
|
||||
|
||||
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")
|
||||
|
|
|
@ -2834,6 +2834,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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue