summaryrefslogtreecommitdiffstats
path: root/Modules/_localemodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-02-16 11:28:22 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-02-16 11:28:22 (GMT)
commit1a1ff29659f068659dea07f1bd67b8fd4331071c (patch)
tree20705986aa369225a02980a11f0a6a66a9eed0ee /Modules/_localemodule.c
parente1efc07a30f4c17723c707ad761bfad538982b0c (diff)
downloadcpython-1a1ff29659f068659dea07f1bd67b8fd4331071c.zip
cpython-1a1ff29659f068659dea07f1bd67b8fd4331071c.tar.gz
cpython-1a1ff29659f068659dea07f1bd67b8fd4331071c.tar.bz2
Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer
overflows. Added few missed PyErr_NoMemory().
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r--Modules/_localemodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index 400c344..b1d6add 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -254,7 +254,7 @@ PyLocale_strxfrm(PyObject* self, PyObject* args)
/* assume no change in size, first */
n1 = n1 + 1;
- buf = PyMem_Malloc(n1 * sizeof(wchar_t));
+ buf = PyMem_New(wchar_t, n1);
if (!buf) {
PyErr_NoMemory();
goto exit;