summaryrefslogtreecommitdiff
path: root/ext/snmp/snmp.c
diff options
context:
space:
mode:
authorBoris Lytochkin <lytboris@php.net>2013-05-03 23:06:34 +0400
committerBoris Lytochkin <lytboris@php.net>2013-05-03 23:06:34 +0400
commitc34274acb8dedda6cbb05a54fa8a2bd0b4533be1 (patch)
treec29443cdc77d6977314d49ed720cc2f951986e79 /ext/snmp/snmp.c
parent3a413f216abb1ce6564d4b8bd493664c32eb928a (diff)
downloadphp-git-c34274acb8dedda6cbb05a54fa8a2bd0b4533be1.tar.gz
re-work walkaround for net-snmp BUGid 2027834, no need to detect it anymore
add test for Bug #64159 bump default buffer size for values(32->512): do not reallocate buffers in 99% cases
Diffstat (limited to 'ext/snmp/snmp.c')
-rw-r--r--ext/snmp/snmp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 9d854ec7fe..c97692822b 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -551,11 +551,7 @@ static void php_snmp_error(zval *object, const char *docref TSRMLS_DC, int type,
static void php_snmp_getvalue(struct variable_list *vars, zval *snmpval TSRMLS_DC, int valueretrieval)
{
zval *val;
-#ifdef BUGGY_SNMPRINT_VALUE
- char sbuf[2048];
-#else
- char sbuf[64];
-#endif
+ char sbuf[512];
char *buf = &(sbuf[0]);
char *dbuf = (char *)NULL;
int buflen = sizeof(sbuf) - 1;
@@ -569,6 +565,10 @@ static void php_snmp_getvalue(struct variable_list *vars, zval *snmpval TSRMLS_D
while ((valueretrieval & SNMP_VALUE_PLAIN) == 0) {
*buf = '\0';
if (snprint_value(buf, buflen, vars->name, vars->name_length, vars) == -1) {
+ if (val_len > 512*1024) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "snprint_value() asks for a buffer more than 512k, Net-SNMP bug?");
+ break;
+ }
/* buffer is not long enough to hold full output, double it */
val_len *= 2;
} else {