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
|
@ -233,7 +233,7 @@ make_filename(PyObject *prefix, PyObject *name)
|
|||
Py_ssize_t len;
|
||||
|
||||
len = PyUnicode_GET_LENGTH(prefix) + PyUnicode_GET_LENGTH(name) + 1;
|
||||
p = buf = PyMem_Malloc(sizeof(Py_UCS4) * len);
|
||||
p = buf = PyMem_New(Py_UCS4, len);
|
||||
if (buf == NULL) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue