php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: thies at digicol dot de
New email:
PHP Version: OS:

 

 [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");
            RETURN_FALSE;
        }
        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) {
....

regards,
tc

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

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: Thu Apr 25 22:01:29 2024 UTC