summaryrefslogtreecommitdiffstats
path: root/Modules/getpath.c
diff options
context:
space:
mode:
authornurelin <nurelin@nurelin.eu>2017-09-21 06:08:20 (GMT)
committerBenjamin Peterson <benjamin@python.org>2017-09-21 06:08:20 (GMT)
commit3d1e2ab584ed0175592b5be2a0bc98dc1723776a (patch)
tree7f52f499c7ca56dab06b599b22a546c1f78d9b0c /Modules/getpath.c
parentb091bec824137f286b22084be5f8d397d21b9abb (diff)
downloadcpython-3d1e2ab584ed0175592b5be2a0bc98dc1723776a.zip
cpython-3d1e2ab584ed0175592b5be2a0bc98dc1723776a.tar.gz
cpython-3d1e2ab584ed0175592b5be2a0bc98dc1723776a.tar.bz2
bpo-31532: Fix memory corruption due to allocator mix (#3679)
Fix a memory corruption in getpath.c due to mixed memory allocators between Py_GetPath() and Py_SetPath(). The fix use the Raw allocator to mimic the windows version. This patch should be used from python3.6 to the current version for more details, see the bug report and https://github.com/pyinstaller/pyinstaller/issues/2812
Diffstat (limited to 'Modules/getpath.c')
-rw-r--r--Modules/getpath.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/getpath.c b/Modules/getpath.c
index 0f91643..dd3387a 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -735,7 +735,7 @@ calculate_path(void)
bufsz += wcslen(zip_path) + 1;
bufsz += wcslen(exec_prefix) + 1;
- buf = PyMem_New(wchar_t, bufsz);
+ buf = PyMem_RawMalloc(bufsz * sizeof(wchar_t));
if (buf == NULL) {
Py_FatalError(
"Not enough memory for dynamic PYTHONPATH");