mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer
overflows. Added few missed PyErr_NoMemory().
This commit is contained in:
parent
e1efc07a30
commit
1a1ff29659
15 changed files with 50 additions and 52 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue