From 1a1ff29659f068659dea07f1bd67b8fd4331071c Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 16 Feb 2015 13:28:22 +0200 Subject: Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer overflows. Added few missed PyErr_NoMemory(). --- Modules/getpath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Modules/getpath.c') diff --git a/Modules/getpath.c b/Modules/getpath.c index c057737ec2..13e3817260 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 = (wchar_t *)PyMem_Malloc(bufsz * sizeof(wchar_t)); + buf = PyMem_New(wchar_t, bufsz); if (buf == NULL) { Py_FatalError( "Not enough memory for dynamic PYTHONPATH"); -- cgit v1.2.1