Re: Re: Bug #1251 Updated: snmpwalk function causes segfault

From: Date: Sat, 03 Apr 1999 17:37:18 +0000
Subject: Re: Re: Bug #1251 Updated: snmpwalk function causes segfault
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-4906@lists.php.net to get a copy of this message
On Sat, Apr 03, 1999 at 07:25:38PM +0200, Michal Kara wrote: > > I've used exactly that version to test snmprealwalk. Please check if you have > > old libraries/header files somewhere which conflict with the latest version. > > > > Running your program yields: > > > > $ ./php snmp > > Content-type: text/html > > > > Hello world! > > '0' = '"Linux flaubert.foo.bar 2.2.2-ac7 #3 Die M_r 30 23:33:04 CEST > > 1999 > > alpha"'<BR> > > '1' = 'OID: enterprises.ucdavis.ucdSnmpAgent.linux'<BR> > > [...] > > > > I traced down the bug and fixed it so that it works for me. The point was > that the 'community' string that is passed to snmp_open points to php > variable value, inside the variable structure. I understand the point you address so there is no need to reiterate on it. > The snmp library frees this string in the snmp_free function. But since it > does not point to separately allocated memory, it is not correct to call > free() on it. That's when my php crashes. Maybe your's C library survives > this attempt??? Please see snmplib/snmp_api.c in the UCD distribution and have a look at snmp_sess_open(). It allocates memory for the community string. This memory is freed afterwards and (I don't know why) this fails at your site. This is *always* done, unless NO_ZEROLENGTH_COMMUNITY is not defined. -- Regards, Sascha Schumann | Consultant | finger sas@schell.de | for PGP public key -- 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

« previous php.dev (#4906) next »