mirror of
https://github.com/python/cpython
synced 2024-10-04 21:09:38 +00:00
[3.12] gh-115136: Fix possible NULL deref in getpath_joinpath() (GH-115137) (GH-115157)
(cherry picked from commit 9e90313320
)
Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
Co-authored-by: Artem Chernyshev <62871052+dTenebrae@users.noreply.github.com>
This commit is contained in:
parent
2016fbd682
commit
dc01c84ed0
|
@ -259,6 +259,10 @@ getpath_joinpath(PyObject *Py_UNUSED(self), PyObject *args)
|
|||
}
|
||||
/* Convert all parts to wchar and accumulate max final length */
|
||||
wchar_t **parts = (wchar_t **)PyMem_Malloc(n * sizeof(wchar_t *));
|
||||
if (parts == NULL) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
memset(parts, 0, n * sizeof(wchar_t *));
|
||||
Py_ssize_t cchFinal = 0;
|
||||
Py_ssize_t first = 0;
|
||||
|
|
Loading…
Reference in a new issue