| 
	
 | 
 Posted by Janwillem Borleffs on 02/10/07 22:38 
deko wrote: 
> geturl.php 
> 
> Too much code to paste here, but have a look at 
> http://www.liarsscourge.com/ 
> So far, I have not found a string that can break this... 
> 
> Any built-in functions or suggestions for improvement? 
> 
 
1. Increase the error_reporting level and you will find some sloppy notices 
2. Have a look at parse_url(), which might be useful 
3. Use preg_* functions instead of POSIX ereg* function (performance) 
4. Strings like the following cause infinite loops: 
 
getURL('fofo http://discovery.co.uk/../foo'); 
 
Probable fix: 
 
= Replace: 
 
if (!eregi("^(com|net|org...)$", $urlString_a[$i])) { 
    ... 
} 
 
= With: 
 
if (preg_match("!^(com|net|org...)[^$]!", $urlString_a[$i], $m)) { 
    $urlString_a[$i] = $m[1]; 
} 
 
 
JW
 
  
Navigation:
[Reply to this message] 
 |