Skip to content

Commit 10b8972

Browse files
committed
fix a segfault caused by NULL dereference
1 parent f363baa commit 10b8972

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Modules/posixmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8038,8 +8038,8 @@ py_posix_spawn(int use_posix_spawnp, PyObject *module, path_t *path, PyObject *a
80388038
if (err_code) {
80398039
errno = err_code;
80408040
#ifdef HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP
8041-
Py_ssize_t cwd_size = PyList_GET_SIZE(cwd_buffer);
8042-
if (errno == ENOENT && cwd_size > 0) {
8041+
Py_ssize_t cwd_size;
8042+
if (errno == ENOENT && cwd_buffer && (cwd_size = PyList_GET_SIZE(cwd_buffer))) {
80438043
/* ENOENT can occur when either the path of the executable or any of
80448044
* the cwds given via file_actions doesn't exist. Since it's not
80458045
* possible to determine which of those paths caused the problem,

0 commit comments

Comments
 (0)