Crach with pear remote-list
| From: | Tomas V.V.Cox | Date: | Tue, 21 May 2002 11:05:37 +0000 |
| Subject: | Crach with pear remote-list | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-6280@lists.php.net to get a copy of this message | ||
While playing with "pear remote-list" I'm getting PHP segfaults. The
problem (reproduceable) is comming from a ereg("^.*\r\n\r\n", $data,
$foo) when $data is a large string (for ex a 53Kb XML_RPC response).
preg_match_all("|^.*\r\n\r\n|s") and ereg_replace() dumps core too.
A quick patch to XML_RPC/RPC.php is here:
$ diff -Bbu ~/temp/download/repo_pear/pear/XML_RPC/RPC.php RPC.php
--- /root/temp/download/repo_pear/pear/XML_RPC/RPC.php Tue May 21
12:57:51 2002+++ RPC.php Tue May 21 12:56:36 2002
@@ -639,9 +640,11 @@
xml_parser_free($parser);
return $r;
}
// gotta get rid of headers here
- if ((!$hdrfnd) &&
ereg("^(.*)\r\n\r\n",$data,$XML_RPC_xh[$parser]['ha'])) {
- $data=ereg_replace("^.*\r\n\r\n", "", $data);
+ $first = substr($data, 0, 1024);
+ if ((!$hdrfnd) &&
ereg("^(.*)\r\n\r\n",$first,$XML_RPC_xh[$parser]['ha'])) {
+ $data=preg_replace("|^.*\r\n\r\n|Us", "", $data);
$hdrfnd=1;
}
Any poblems if I commit it?
Tomas V.V.Cox