|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-12-24 03:17 UTC] mfischer@php.net
[2002-01-06 07:46 UTC] sander@php.net
[2002-01-27 05:19 UTC] sander@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 18:00:01 2025 UTC |
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); }