mirror of
https://github.com/python/cpython.git
synced 2024-11-23 18:04:37 +08:00
gh-115136: Fix possible NULL deref in getpath_joinpath() (GH-115137)
Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
This commit is contained in:
parent
4a7f63869a
commit
9e90313320
@ -262,6 +262,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 New Issue
Block a user