summaryrefslogtreecommitdiff
path: root/ext/snmp/snmp.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2016-08-03 22:37:57 -0700
committerAnatol Belski <ab@php.net>2016-08-16 14:22:10 +0200
commitb735a4419c1e796520b395a2aa0b6943d9157b73 (patch)
treedf39a0ed2acc68bd09f0d30115b36b9e146a3fb1 /ext/snmp/snmp.c
parente70069a62fb7252252cad9506fac5baf4ac11d21 (diff)
downloadphp-git-b735a4419c1e796520b395a2aa0b6943d9157b73.tar.gz
Fix bug #72708 - php_snmp_parse_oid integer overflow in memory allocation
(cherry picked from commit c3f6d6da100c6451a540680504de4105b8bed83c) Conflicts: ext/snmp/snmp.c main/php_version.h
Diffstat (limited to 'ext/snmp/snmp.c')
-rw-r--r--ext/snmp/snmp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 7b685ff5dc..63e8095ed7 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -1011,7 +1011,7 @@ static int php_snmp_parse_oid(zval *object, int st, struct objid_query *objid_qu
php_error_docref(NULL, E_WARNING, "Got empty OID array");
return FALSE;
}
- objid_query->vars = (snmpobjarg *)emalloc(sizeof(snmpobjarg) * zend_hash_num_elements(Z_ARRVAL_P(oid)));
+ objid_query->vars = (snmpobjarg *)safe_emalloc(sizeof(snmpobjarg), zend_hash_num_elements(Z_ARRVAL_P(oid)), 0);
if (objid_query->vars == NULL) {
php_error_docref(NULL, E_WARNING, "emalloc() failed while parsing oid array: %s", strerror(errno));
efree(objid_query->vars);