From: Serhiy Storchaka Date: Wed, 5 Oct 2022 09:51:58 +0000 (+0300) Subject: gh-97758: Fix a crash in getpath_joinpath() called without arguments (GH-97759) X-Git-Tag: v3.12.0a1~243 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f8cbd79d328d90443acabc41d246332c302c815a;p=thirdparty%2FPython%2Fcpython.git gh-97758: Fix a crash in getpath_joinpath() called without arguments (GH-97759) --- diff --git a/Modules/getpath.c b/Modules/getpath.c index be704adbde94..ceacf36d8968 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -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 *));