Bug #13585: nonsense code

From: Date: Sun, 07 Oct 2001 11:40:48 +0000
Subject: Bug #13585: nonsense code
Groups: php.dev 
Request: Send a blank email to php-dev+get-67471@lists.php.net to get a copy of this message
From: s.esser@e-matters.de Operating system: PHP version: 4.0CVS-2001-10-07 PHP Bug Type: HTTP related Bug description: nonsense code 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 bug report at: http://bugs.php.net/?id=13585&edit=1

« previous php.dev (#67471) next »