Re: cvs: php4 /main SAPI.c
| From: | Andi Gutmans | Date: | Sat, 03 Aug 2002 09:20:17 +0000 |
| Subject: | Re: cvs: php4 /main SAPI.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-13097@lists.php.net to get a copy of this message | ||
At 07:49 AM 8/1/2002 +0000, Rasmus Lerdorf wrote:
Doesn't the sizeof() cover the '\0' (Disclaimer: I don't know this code). Andirasmus Thu Aug 1 03:49:54 2002 EDTModified files:/php4/main SAPI.cLog: Need room for the \0 here to avoid an overflow Index: php4/main/SAPI.c diff -u php4/main/SAPI.c:1.139 php4/main/SAPI.c:1.140--- php4/main/SAPI.c:1.139 Wed Jul 31 13:55:15 2002 +++ php4/main/SAPI.c Thu Aug 1 03:49:53 2002@@ -18,7 +18,7 @@+----------------------------------------------------------------------+*/ -/* $Id: SAPI.c,v 1.139 2002/07/31 17:55:15 helly Exp $ */ +/* $Id: SAPI.c,v 1.140 2002/08/01 07:49:53 rasmus Exp $ */ #include <ctype.h> #include <sys/stat.h> @@ -220,7 +220,7 @@charset = SG(default_charset) ? SG(default_charset) : SAPI_DEFAULT_CHARSET;if (strncasecmp(mimetype, "text/", 5) == 0 && *charset) { - int len = strlen(mimetype) + sizeof("; charset=") + strlen(charset); + int len = strlen(mimetype) + sizeof("; charset=") + strlen(charset)+1; content_type = emalloc(len); snprintf(content_type, len, "%s; charset=%s", mimetype, charset); } else {