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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
8 + 41 = ?
Subscribe to this entry?

 
 [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: Sun May 19 11:01:37 2024 UTC