Re: Bug #1251 Updated: snmpwalk function causes segfault
| From: | Michal Kara | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: Bug #1251 Updated: snmpwalk function causes segfault | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-4900@lists.php.net to get a copy of this message | ||
> ID: 1251
> Updated by: sas
> Reported By: lemming@k332.feld.cvut.cz
> Status: Open
> Bug Type: Reproduceable crash
> Assigned To:
> Comments:
>
> I cannot reproduce that effect here. Could you provide a backtrace?
>
Make sure to use ucd-snmp-3.6.1 . Maybe they changed function? As I wrote,
the problem is that snmp_free frees community string you used, but php
passes pointer to its variable structure.
---
Backtrace:
Starting program: /usr/local/bin/php snmp.php
Content-type: text/html
Hello world!
Program received signal SIGSEGV, Segmentation fault.
0x400c3373 in chunk_free (ar_ptr=0x4011d1a0, p=0x80f3840) at malloc.c:2945
malloc.c:2945: No such file or directory.
(gdb) bt
#0 0x400c3373 in chunk_free (ar_ptr=0x4011d1a0, p=0x80f3840) at malloc.c:2945
#1 0x400c3241 in __libc_free (mem=0x80f3848) at malloc.c:2872
#2 0x8092300 in snmp_free (cp=0x80f3848) at snmp_api.c:650
#3 0x80923bf in snmp_sess_close (sessp=0x80f47d0) at snmp_api.c:700
#4 0x8092432 in snmp_close (session=0x80f4800) at snmp_api.c:734
#5 0x80821ec in _php3_snmp (ht=0x80f3720, return_value=0x80b5478, list=0x80c70e8,
plist=0x80c70bc, st=2) at functions/snmp.c:257
#6 0x808224b in php3_snmpwalk (ht=0x80f3720, return_value=0x80b5478, list=0x80c70e8,
plist=0x80c70bc) at functions/snmp.c:270
#7 0x8053b9c in phpparse () at control_structures_inline.h:930
#8 0x805ad57 in php3_parse (yyin=0x80ed6c8) at main.c:1534
#9 0x805b5b9 in main (argc=2, argv=0xbffff8a4) at main.c:1842
---------------
The program that caused segfault:
-
Hello world!
<?
$a = snmpwalk("localhost","public","system");
while(list($k,$v) = each($a)) echo "'$k' = '$v'<BR>\n";
?>
-
I hope this will help.
Michal Kara alias lemming
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net