Bug #13585 Updated: nonsense code
| From: | sniper@php.net | Date: | Sun, 28 Oct 2001 22:15:54 +0000 |
| Subject: | Bug #13585 Updated: nonsense code | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-69224@lists.php.net to get a copy of this message | ||
ID: 13585
Updated by: sniper
Reported By: s.esser@e-matters.de
Old Status: Open
Status: Feedback
Bug Type: HTTP related
Operating System:
PHP Version: 4.0CVS-2001-10-07
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2001-10-07 07:40:48] s.esser@e-matters.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);
....
--------------------------
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13585&edit=1