Author: thomas.heller Date: Thu Aug 30 19:15:14 2007 New Revision: 57731 Modified: python/branches/py3k/Lib/test/test_os.py python/branches/py3k/Modules/posixmodule.c Log: Forbid an empty argument list in execv call.
Fixes issue 1039. Modified: python/branches/py3k/Lib/test/test_os.py ============================================================================== --- python/branches/py3k/Lib/test/test_os.py (original) +++ python/branches/py3k/Lib/test/test_os.py Thu Aug 30 19:15:14 2007 @@ -441,6 +441,9 @@ 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") Modified: python/branches/py3k/Modules/posixmodule.c ============================================================================== --- python/branches/py3k/Modules/posixmodule.c (original) +++ python/branches/py3k/Modules/posixmodule.c Thu Aug 30 19:15:14 2007 @@ -2834,6 +2834,11 @@ 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) { _______________________________________________ Python-3000-checkins mailing list Python-3000-checkins@python.org http://mail.python.org/mailman/listinfo/python-3000-checkins