|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13585 nonsense code
Submitted: 2001-10-07 07:40 UTC Modified: 2001-11-18 10:06 UTC
From: s dot esser at e-matters dot de Assigned:
Status: Closed Package: HTTP related
PHP Version: 4.0CVS-2001-10-07 OS:
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.
Block user comment
Status: Assign to:
Bug Type:
From: s dot esser at e-matters dot de
New email:
PHP Version: OS:


 [2001-10-07 07:40 UTC] s dot esser at e-matters dot de
The following piece of code is taken from
it is obvious that this code is nonsense
a) *ptr will point to \0 because someone forgot to increase it (the while loop will never be executed)
b) the second condition in the while loop is redundant
c) the size calculation should be done *after* the while loop

colon_offset = strchr(header_line, ':');
if (colon_offset) {
   *colon_offset = 0;
   if (!STRCASECMP(header_line, "Content-Type")) {
      char *ptr = colon_offset, *mimetype = NULL, *newheader;
      size_t len = header_line_len - (ptr - header_line), newlen;
      while (*ptr == ' ' && *ptr != '\0') {
      mimetype = estrdup(ptr);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-28 17:15 UTC]
Could you please explain also where this code fails?
If you have some short example script too, that would
help to see the whole picture.


 [2001-11-18 10:06 UTC]
No feedback. Closing.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jun 12 23:01:24 2021 UTC