Skip to content

Commit

Permalink
pythongh-115136: Fix possible NULL deref in getpath_joinpath() (pytho…
Browse files Browse the repository at this point in the history
…nGH-115137)

Signed-off-by: Artem Chernyshev <[email protected]>
  • Loading branch information
dTenebrae authored Feb 8, 2024
1 parent 4a7f638 commit 9e90313
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Modules/getpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9e90313

Please sign in to comment.