Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer

overflows.  Added few missed PyErr_NoMemory().
This commit is contained in:
Serhiy Storchaka 2015-02-16 13:28:22 +02:00
parent e1efc07a30
commit 1a1ff29659
15 changed files with 50 additions and 52 deletions

View file

@ -1516,7 +1516,7 @@ unicode_aswidechar(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "Un", &unicode, &buflen))
return NULL;
buffer = PyMem_Malloc(buflen * sizeof(wchar_t));
buffer = PyMem_New(wchar_t, buflen);
if (buffer == NULL)
return PyErr_NoMemory();