mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +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
1 changed files with 4 additions and 0 deletions
|
@ -259,6 +259,10 @@ getpath_joinpath(PyObject *Py_UNUSED(self), PyObject *args)
|
||||||
}
|
}
|
||||||
/* Convert all parts to wchar and accumulate max final length */
|
/* Convert all parts to wchar and accumulate max final length */
|
||||||
wchar_t **parts = (wchar_t **)PyMem_Malloc(n * sizeof(wchar_t *));
|
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 *));
|
memset(parts, 0, n * sizeof(wchar_t *));
|
||||||
Py_ssize_t cchFinal = 0;
|
Py_ssize_t cchFinal = 0;
|
||||||
Py_ssize_t first = 0;
|
Py_ssize_t first = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue