Skip to content

Commit

Permalink
pythongh-97758: Fix a crash in getpath_joinpath() called without argu…
Browse files Browse the repository at this point in the history
…ments (pythonGH-97759)

(cherry picked from commit f8cbd79)

Co-authored-by: Serhiy Storchaka <[email protected]>
  • Loading branch information
serhiy-storchaka authored and miss-islington committed Oct 5, 2022
1 parent 79b5c1a commit 024bc08
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Modules/getpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ getpath_joinpath(PyObject *Py_UNUSED(self), PyObject *args)
}
Py_ssize_t n = PyTuple_GET_SIZE(args);
if (n == 0) {
return PyUnicode_FromString(NULL);
return PyUnicode_FromStringAndSize(NULL, 0);
}
/* Convert all parts to wchar and accumulate max final length */
wchar_t **parts = (wchar_t **)PyMem_Malloc(n * sizeof(wchar_t *));
Expand Down

0 comments on commit 024bc08

Please sign in to comment.