Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.11] gh-97758: Fix a crash in getpath_joinpath() called without arguments (GH-97759) #97903

Merged
merged 1 commit into from
Oct 5, 2022
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 <[email protected]>
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
@@ -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 *));