ID: 14679
Updated by: mfischer
Reported By: hps@intermeta.de
Status: Open
Bug Type: Reproducible crash
Operating System: Linux
PHP Version: 4.0CVS-2001-12-23
New Comment:
Please send the patch as attachment as a reply to this mail (line ending got fscked up). Also, next
time please don't open a new report.
Previous Comments:
------------------------------------------------------------------------
[2001-12-23 21:18:17] hps@intermeta.de
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 this bug report at http://bugs.php.net/?id=14679&edit=1