summaryrefslogtreecommitdiffstats
path: root/Modules/pyexpat.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/pyexpat.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/pyexpat.c')
-rw-r--r--Modules/pyexpat.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index 4ced53b..19be0c7 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -928,7 +928,7 @@ xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
for (i = 0; handler_info[i].name != NULL; i++)
/* do nothing */;
- new_parser->handlers = PyMem_Malloc(sizeof(PyObject *) * i);
+ new_parser->handlers = PyMem_New(PyObject *, i);
if (!new_parser->handlers) {
Py_DECREF(new_parser);
return PyErr_NoMemory();
@@ -1121,7 +1121,7 @@ newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
for (i = 0; handler_info[i].name != NULL; i++)
/* do nothing */;
- self->handlers = PyMem_Malloc(sizeof(PyObject *) * i);
+ self->handlers = PyMem_New(PyObject *, i);
if (!self->handlers) {
Py_DECREF(self);
return PyErr_NoMemory();