]> granicus.if.org Git - python/commitdiff
Issue #28732: Raise ValueError when argv[0] is empty.
authorSteve Dower <steve.dower@microsoft.com>
Sun, 20 Nov 2016 03:03:54 +0000 (19:03 -0800)
committerSteve Dower <steve.dower@microsoft.com>
Sun, 20 Nov 2016 03:03:54 +0000 (19:03 -0800)
Modules/posixmodule.c

index 6170ff7f79be47a44cbddc4ccbd2d22185ce9161..3e446a524e9e93e1c4fd5f661691ae27c1e944bf 100644 (file)
@@ -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;