summaryrefslogtreecommitdiffstats
path: root/Modules/pyexpat.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-02-16 11:33:32 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-02-16 11:33:32 (GMT)
commit4d0d9829851915e97ae392dd803976be6c95c8d1 (patch)
treee93666c54592b95dbca422ec66d0896f827957b3 /Modules/pyexpat.c
parent53fa8b2a4bbb589d3d761284c70f93e0f852df23 (diff)
parent1a1ff29659f068659dea07f1bd67b8fd4331071c (diff)
downloadcpython-4d0d9829851915e97ae392dd803976be6c95c8d1.zip
cpython-4d0d9829851915e97ae392dd803976be6c95c8d1.tar.gz
cpython-4d0d9829851915e97ae392dd803976be6c95c8d1.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 3f34e63..21cb04a 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -1093,7 +1093,7 @@ pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self, const ch
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();
@@ -1416,7 +1416,7 @@ newxmlparseobject(const char *encoding, const char *namespace_separator, PyObjec
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();