com php-src: Fix bug #72708 - php_snmp_parse_oid intege r overflow in memory allocation: ext/snmp/snmp.c
| From: | Ferenc Kovacs | Date: | Thu, 18 Aug 2016 10:51:13 +0000 |
| Subject: | com php-src: Fix bug #72708 - php_snmp_parse_oid intege r overflow in memory allocation: ext/snmp/snmp.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-93954@lists.php.net to get a copy of this message | ||
Commit: b9ab6e14ffd602d2020da53be44bf2e77aae7b55
Author: Stanislav Malyshev <stas@php.net> Wed, 3 Aug 2016 22:37:57 -0700
Committer: Ferenc Kovacs <tyra3l@gmail.com> Thu, 18 Aug 2016 12:51:13 +0200
Parents: 61156f0d68704df748b5cbf08c77582c208db8c9
Branches: PHP-5.6.25
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b9ab6e14ffd602d2020da53be44bf2e77aae7b55
Log:
Fix bug #72708 - php_snmp_parse_oid integer overflow in memory allocation
Bugs:
https://bugs..php.net/72708
Changed paths:
M ext/snmp/snmp.c
Diff:
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index b88cdcd..d2c1b94 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -1032,7 +1032,7 @@ static int php_snmp_parse_oid(zval *object, int st, struct objid_query
*objid_qu
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Got empty OID array");
return FALSE;
}
- objid_query->vars = (snmpobjarg *)emalloc(sizeof(snmpobjarg) *
zend_hash_num_elements(Z_ARRVAL_PP(oid)));
+ objid_query->vars = (snmpobjarg *)safe_emalloc(sizeof(snmpobjarg),
zend_hash_num_elements(Z_ARRVAL_PP(oid)), 0);
if (objid_query->vars == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "emalloc() failed while parsing oid array:
%s", strerror(errno));
efree(objid_query->vars);