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
  • Loading branch information
serhiy-storchaka committed Oct 3, 2022
1 parent 0ee9619 commit 41a73a4
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 41a73a4

Please sign in to comment.