Bug #13585 Updated: nonsense code

From: Date: Sun, 18 Nov 2001 15:06:54 +0000
Subject: Bug #13585 Updated: nonsense code
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-70816@lists.php.net to get a copy of this message
ID: 13585 Updated by: sander Reported By: s.esser@e-matters.de Old Status: Feedback Status: Closed Bug Type: HTTP related Operating System: PHP Version: 4.0CVS-2001-10-07 New Comment: No feedback. Closing. Previous Comments: ------------------------------------------------------------------------ [2001-10-28 17:15:54] 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-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

« previous php.dev (#70816) next »