Bug #14679: Crash with RH ucd-snmp libs -- BUGFIX

From: Date: Mon, 24 Dec 2001 02:18:18 +0000
Subject: Bug #14679: Crash with RH ucd-snmp libs -- BUGFIX
Groups: php.dev 
Request: Send a blank email to php-dev+get-74895@lists.php.net to get a copy of this message
From: hps@intermeta.de Operating system: Linux PHP version: 4.0CVS-2001-12-23 PHP Bug Type: Reproducible crash Bug description: Crash with RH ucd-snmp libs -- BUGFIX hi, this is the fix for the snmp crash with recent red hat libraries. Compile fix is to check for binit() in libsnmp and if yes, use the following calls. Addition of binit() check in configure.in is left as an exercise for the reader. ;-) --- php-4.1.0/ext/snmp/snmp.c Mon Dec 24 03:11:23 2001 +++ /tmp/snmp.c Mon Dec 24 03:10:55 2001 @@ -158,8 +158,9 @@ int name_length; int status, count,rootlen=0,gotroot=0; oid root[MAX_NAME_LEN]; - char buf[2048]; - char buf2[2048]; +#define BUFSIZE 2048 + char buf[BUFSIZE]; + char buf2[BUFSIZE]; int keepwalking=1; long timeout=SNMP_DEFAULT_TIMEOUT; long retries=SNMP_DEFAULT_RETRIES; @@ -315,7 +316,7 @@ } if (st != 11) { - sprint_value(buf,vars->name, vars->name_length, vars); + sprint_value(binit(NULL, buf, BUFSIZE) ,vars->name, vars->name_length, vars); } #if 0 Debug("snmp response is: %s\n",buf); @@ -325,7 +326,7 @@ } else if (st == 2) { add_next_index_string(return_value,buf,1); /* Add to returned array */ } else if (st == 3) { - sprint_objid(buf2, vars->name, vars->name_length); + sprint_objid(binit(NULL, buf2, BUFSIZE), vars->name, vars->name_length); add_assoc_string(return_value,buf2,buf,1); } if (st >= 2 && st != 11) { @@ -344,7 +345,7 @@ for (count=1, vars = response->variables; vars && count != response->errindex; vars = vars->next_variable, count++); if (vars) { - sprint_objid(buf,vars->name, vars->name_length); + sprint_objid(binit(NULL, buf, BUFSIZE), vars->name, vars->name_length); } php_error(E_WARNING,"This name does not exist: %s\n",buf); } -- Edit bug report at: http://bugs.php.net/?id=14679&edit=1

« previous php.dev (#74895) next »