mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
[3.11] gh-115136: Fix possible NULL deref in getpath_joinpath() (GH-115137) (ПР-115158)
(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
5e686dffa4
commit
214ac16696
1 changed files with 4 additions and 0 deletions
|
|
@ -265,6 +265,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…
Add table
Add a link
Reference in a new issue