]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-97758: Fix a crash in getpath_joinpath() called without arguments (GH-97759)
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 5 Oct 2022 09:51:58 +0000 (12:51 +0300)
committerGitHub <noreply@github.com>
Wed, 5 Oct 2022 09:51:58 +0000 (12:51 +0300)
Modules/getpath.c

index be704adbde9468dca63396578311bb843c18001c..ceacf36d8968a1fe268b6b66ff4373abde4dfb5f 100644 (file)
@@ -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 *));