Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-97758: Fix a crash in getpath_joinpath() called without arguments (G…
…H-97759)

(cherry picked from commit f8cbd79)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
  • Loading branch information
serhiy-storchaka authored and miss-islington committed Oct 5, 2022
commit 024bc08c5b759847f0c439e050e0ddee6b9b4590
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