Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 93ff872

Browse files
committed
Issue #28732: Raise ValueError when argv[0] is empty.
1 parent 11f4326 commit 93ff872

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Modules/posixmodule.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5210,6 +5210,15 @@ os_spawnv_impl(PyObject *module, int mode, PyObject *path, PyObject *argv)
52105210
"spawnv() arg 2 must contain only strings");
52115211
return NULL;
52125212
}
5213+
#ifdef MS_WINDOWS
5214+
if (i == 0 && !argvlist[0][0]) {
5215+
free_string_array(argvlist, i);
5216+
PyErr_SetString(
5217+
PyExc_ValueError,
5218+
"spawnv() arg 2 first element cannot be empty");
5219+
return NULL;
5220+
}
5221+
#endif
52135222
}
52145223
argvlist[argc] = NULL;
52155224

0 commit comments

Comments
 (0)