From: Rasmus Lerdorf Date: Sat, 3 Aug 2002 14:09:56 +0000 (+0000) Subject: Yup, sizeof() includes the space for the \0 X-Git-Tag: dev~42 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c8bf1652424328e712aaf5af6e3fee436458821d;p=php Yup, sizeof() includes the space for the \0 --- diff --git a/main/SAPI.c b/main/SAPI.c index bc50b0388f..f03b858f56 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -220,7 +220,7 @@ SAPI_API char *sapi_get_default_content_type(TSRMLS_D) 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)+1; + int len = strlen(mimetype) + sizeof("; charset=") + strlen(charset); /* sizeof() includes \0 */ content_type = emalloc(len); snprintf(content_type, len, "%s; charset=%s", mimetype, charset); } else {