From 93ff8725b3f678586fbbc19d3d4b615b218300ff Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Sat, 19 Nov 2016 19:03:54 -0800 Subject: [PATCH] Issue #28732: Raise ValueError when argv[0] is empty. --- Modules/posixmodule.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 6170ff7f79b..3e446a524e9 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -5210,6 +5210,15 @@ os_spawnv_impl(PyObject *module, int mode, PyObject *path, PyObject *argv) "spawnv() arg 2 must contain only strings"); return NULL; } +#ifdef MS_WINDOWS + if (i == 0 && !argvlist[0][0]) { + free_string_array(argvlist, i); + PyErr_SetString( + PyExc_ValueError, + "spawnv() arg 2 first element cannot be empty"); + return NULL; + } +#endif } argvlist[argc] = NULL;