|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #757 strpos is not binary save
Submitted: 1998-09-18 10:46 UTC Modified: 1998-09-18 11:05 UTC
From: thies at digicol dot de Assigned:
Status: Closed Package: Other
PHP Version: 3.0 Latest CVS OS: all
Private report: No CVE-ID: None
 [1998-09-18 10:46 UTC] thies at digicol dot de
line 520:
    if (needle->type == IS_STRING) {
        if (strlen(needle->value.str.val)==0) {
            php3_error(E_WARNING,"Empty delimiter");
        found = strstr(haystack->value.str.val, needle->value.str.val);

stig told me, that php strings should be binary safe, i believe that the strlen in the strpos-function is not.

i believe it sould read:

if (needle->value.str.lenl==0) {



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1998-09-18 11:05 UTC] zeev

strpos() as it is right now is not binary safe, and
that check is intentional, to protect the binary
unsafe implementation from receiving unexpected
arguments (and thus crash).
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Feb 25 23:01:33 2024 UTC