summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorArtem Chernyshev <62871052+dTenebrae@users.noreply.github.com>2024-02-08 08:40:38 (GMT)
committerGitHub <noreply@github.com>2024-02-08 08:40:38 (GMT)
commit9e90313320a2af2d9ff7049ed3842344ed236630 (patch)
tree0fcf2e6dd37e4dc308d59116117838a1af740ff3 /Modules
parent4a7f63869aa61b24a7cc2d33f8a5e5a7fd0d76a4 (diff)
downloadcpython-9e90313320a2af2d9ff7049ed3842344ed236630.zip
cpython-9e90313320a2af2d9ff7049ed3842344ed236630.tar.gz
cpython-9e90313320a2af2d9ff7049ed3842344ed236630.tar.bz2
gh-115136: Fix possible NULL deref in getpath_joinpath() (GH-115137)
Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
Diffstat (limited to 'Modules')
-rw-r--r--Modules/getpath.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/getpath.c b/Modules/getpath.c
index a3c8fc2..abed139 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -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;