Re: Bug #14679 Updated: Crash with RH ucd-snmp libs -- BUGFIX
| From: | Henning Schmiedehausen | Date: | Mon, 24 Dec 2001 11:27:48 +0000 |
| Subject: | Re: Bug #14679 Updated: Crash with RH ucd-snmp libs -- BUGFIX | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-74909@lists.php.net to get a copy of this message | ||
On Mon, 2001-12-24 at 09:17, Bug Database wrote:
>
>
> ATTENTION! Do NOT reply to this email!
> To reply, use the web interface found at
> http://bugs.php.net/?id=14679&edit=2
>
>
> 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.
Great, if you would tell me how to add a comment to an existing bug
report if I'm neither owner nor developer.
And if you would point people somewhere to snaps.php.net, building of
the existing snapshots would be much easier. :-)
Patch attached
Regards
Henning
>
> 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);
> }
>
>
> ------------------------------------------------------------------------
>
>
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH hps@intermeta.de
Am Schwabachgrund 22 Fon.: 09131 / 50654-0 info@intermeta.de
D-91054 Buckenhof Fax.: 09131 / 50654-20
--- 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); }
--- 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); }