Re: null character - file related function

From: Date: Mon, 06 Oct 2003 16:06:04 +0000
Subject: Re: null character - file related function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-165194@lists.php.net to get a copy of this message
Hi, On Mon, 6 Oct 2003, Mark Charette wrote: > > Strings in PHP are binary safe and thus do not rely on null temrination. > > You are, of course, right (just a brainfart on my part ...). > > There are a number of functions that depend on null termination of > strings; handing a string with embedded nulls in it to those functions may > result in "interesting" things happening .... And is somewhere written which functions depend on null termination? example 1: I know that this URL is not the correct one (RFC 1738), but if the 0x01 is encoded to \x01 why the 0x00 is not? $a = "http://xxx/test?a=aaa".chr(1).chr(2).chr(0)."bbb"; include($a); (it is requesting: http://xxx/test?a=aaa\x01\x02) example 2: $a = "1234 abc".chr(1).chr(0)."def"; $b = escapeshellcmd($a); echo $b; [$b is "1234 abc".chr(1)] Martin Straka

« previous php.general (#165194) next »