mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.11] gh-102281: Fix potential nullptr dereference + use of uninitia… (#103040)
[3.11] gh-102281: Fix potential nullptr dereference + use of uninitialized memory (gh-102282)
(cherry picked from commit afa6092ee4
)
This commit is contained in:
parent
e1094c6e6a
commit
b28f919007
3 changed files with 10 additions and 2 deletions
|
@ -2142,7 +2142,10 @@ _Py_join_relfile(const wchar_t *dirname, const wchar_t *relfile)
|
|||
}
|
||||
assert(wcslen(dirname) < MAXPATHLEN);
|
||||
assert(wcslen(relfile) < MAXPATHLEN - wcslen(dirname));
|
||||
join_relfile(filename, bufsize, dirname, relfile);
|
||||
if (join_relfile(filename, bufsize, dirname, relfile) < 0) {
|
||||
PyMem_RawFree(filename);
|
||||
return NULL;
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
@ -2180,6 +2183,7 @@ _Py_find_basename(const wchar_t *filename)
|
|||
wchar_t *
|
||||
_Py_normpath(wchar_t *path, Py_ssize_t size)
|
||||
{
|
||||
assert(path != NULL);
|
||||
if (!path[0] || size == 0) {
|
||||
return path;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue