php.net |  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
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: 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
SAPI.C/sapi_add_header_ex
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') {
         ptr++;
      }
      mimetype = estrdup(ptr);
....
--------------------------


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-28 17:15 UTC] sniper@php.net
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.

--Jani

 [2001-11-18 10:06 UTC] sander@php.net
No feedback. Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC