From: Borax at nerim dot net
Operating system: FreeBSD 5.0
PHP version: 4.3.1
PHP Bug Type: Reproducible crash
Bug description: PHP Segfault
Hi.
Before I say something, I scuse me for my poor english :)
I had a problem with a code which I made in order to filter a Cisco PIX's
Syslog.
PHP segfault when I try to execute my script. I give you my script, and
more informations about my system:
#! /bin/php
<?
/* D\xe9claration des variables */
$file = (isset($file))? $file : "/var/log/test";
$i = 0;
$j = 0;
function tri($file){
/* On ouvre le fichier et on met son contenu dans un tableau */
$fd = file($file);
/* R\xe9cup\xe9ration des lignes qui concernent le PIX */
foreach($fd as $id => $texte){
if(ereg("PIX", $texte)){
$tableau[$i] = $texte;
$i++;
}
}
/* Puis on traite chaque ligne valide */
foreach($tableau as $ident => $contenu){
/* On casse la chaine a chaque espace */
unset($buff);
$buff = explode(" ", $contenu);
/* On d\xe9finit les variables qui vont correspondre : */
$buff[0] = $mois;
$buff[1] = $jour;
$buff[2] = $heure;
$buff[3] = $syslog_serv;
$buff[4] = $syslog_hdr;
$buff[5] = $deny;
$buff[6] = $inbound;
$buff[7] = $xlate1;$buff[8] = $xlate2;
$xlate = $xlate1.$xlate2;
$buff[9] = $protocole;
$buff[11] = $src;
$source = explode("/", $src);
$src_ip = $source[0];
$src_port = $source[1];
$buff[13] = $dst;
$dest = explode("/", $dst);
$dst_port = $dest[1];
$dst_ip = $dest[0];
/* On place tout ca dans une structure pour renvoyer le
resultat */
$structure[$j] = array( "src_ip" => $src_ip,
"src_port" => $src_port,
"dst_ip" => $dst_ip,
"dst_port" => $dst_port,
"proto" => $protocole,
"mois" => $mois,
"jour" => $jour,
"heure" => $heure,
"serv" => $syslog_serv,
"hdr" => $syslog_hdr
);
$j++;
}
return($structure);
}
$array = tri($file);
for($k = 0; $buff[$k]; $k++){
echo $buff[$k]["src_ip"];
}
?>
When I execute that, PHP return to me:
neron# ./firewall.php
Content-type: text/html
X-Powered-By: PHP/4.3.1
Segmentation fault (core dumped)
neron# php -v
PHP 4.3.1 (cgi), Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
neron# uname -sr
FreeBSD 5.0-RELEASE
neron#
I think it's suffisant to expose the problem.
If you want something else, you can mail me at Borax@nerim.net
Thanx for PHP, and goodbye.
--
Edit bug report at http://bugs.php.net/?id=23731&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23731&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23731&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23731&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23731&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23731&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23731&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23731&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23731&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23731&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23731&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23731&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23731&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23731&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23731&r=gnused