Re: Bug #757 Updated: strpos is not binary save
| From: | Zeev Suraski | Date: | Fri, 18 Sep 1998 15:03:19 +0000 |
| Subject: | Re: Bug #757 Updated: strpos is not binary save | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-1232@lists.php.net to get a copy of this message | ||
On 18 Sep 1998, Bug Database wrote:
> ID: 757
> Updated by: rasmus
> Reported By: thies@digicol.de
> Status: Closed
> Bug Type: Other
> Assigned To:
> Comments:
>
> Fixes
>
> Full Bug description available at:
> http://ca.php.net/bugs.php3?id=757
Hey, especially in code I hacked, don't assume that an strlen() code is
redundant - I always use str.len when it's applicable.
There's a very good reason for the strlen() call in there, and there's no
meaning to PHP'sstrpos() being binary safe since it uses libc's strstr(),
which isn't binary safe. Changing that reality check will do no good, and
will reintroduce the crash bugs that check solved.
strlen(p->value.str.val) is NOT always identical to p->value.str.len!
Please don't commit or remove that fix. Alternately, the function can be
changed not to use strstr().
Zeev
--
-----------------------------------------------------
Zeev Suraski <zeev@php.net>
For a PGP public key, finger bourbon@netvision.net.il
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net