summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2016-11-20 02:53:19 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2016-11-20 02:53:19 (GMT)
commit859fd7bd7af90ce9a7f3a3184f2fce83013e0a96 (patch)
tree96ffcf08c7c1ebf7b5f721da50c8d35c37771aff /Modules/posixmodule.c
parentc3630612ab4f53976d10db2e22855a5a853788da (diff)
downloadcpython-859fd7bd7af90ce9a7f3a3184f2fce83013e0a96.zip
cpython-859fd7bd7af90ce9a7f3a3184f2fce83013e0a96.tar.gz
cpython-859fd7bd7af90ce9a7f3a3184f2fce83013e0a96.tar.bz2
Issue #28732: Raise ValueError when os.spawn*() is passed an empty tuple of arguments
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index a89da70..0482f2b 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -5042,6 +5042,11 @@ os_spawnv_impl(PyObject *module, int mode, path_t *path, PyObject *argv)
"spawnv() arg 2 must be a tuple or list");
return NULL;
}
+ if (argc == 0) {
+ PyErr_SetString(PyExc_ValueError,
+ "spawnv() arg 2 cannot be empty");
+ return NULL;
+ }
argvlist = PyMem_NEW(EXECV_CHAR *, argc+1);
if (argvlist == NULL) {
@@ -5127,6 +5132,11 @@ os_spawnve_impl(PyObject *module, int mode, path_t *path, PyObject *argv,
"spawnve() arg 2 must be a tuple or list");
goto fail_0;
}
+ if (argc == 0) {
+ PyErr_SetString(PyExc_ValueError,
+ "spawnve() arg 2 cannot be empty");
+ goto fail_0;
+ }
if (!PyMapping_Check(env)) {
PyErr_SetString(PyExc_TypeError,
"spawnve() arg 3 must be a mapping object");