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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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: Sun May 19 11:01:37 2024 UTC