[PATCH] Reproduceable SegFault
| From: | Flavien Lebarbé | Date: | Sun, 27 Aug 2000 01:18:39 +0000 |
| Subject: | [PATCH] Reproduceable SegFault | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-30793@lists.php.net to get a copy of this message | ||
Hi,
I tried this tonight :
---
<?php
for( $i=0;$i<5000;$i++)
$long_one.="a";
fsockopen($long_one,$a,$b);
?>
---
I got a SegFault.
Problematic code :
/php4/ext/standard/fsock.c line 312 :
strcpy(unix_addr.sun_path, (*args[0])->value.str.val);
The problem I have : On my machine, sockaddr_un is defined as :
---"/usr/include/sys/un.h"
struct sockaddr_un
{
sa_family_t sun_family ;
char sun_path[108];
};
---
So, 108 looks to be a YAMN (Yet Another Magic Number) ... :-(
The attached quick-and-dirty patch solves the problem for me.
Flavien.