]> granicus.if.org Git - php/commitdiff
Yup, sizeof() includes the space for the \0
authorRasmus Lerdorf <rasmus@php.net>
Sat, 3 Aug 2002 14:09:56 +0000 (14:09 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Sat, 3 Aug 2002 14:09:56 +0000 (14:09 +0000)
main/SAPI.c

index bc50b0388ffa8b0b4503b6b477c9dfd5c44bc8d0..f03b858f56ea45bfefd6c05a9e14ac9162fcaa2c 100644 (file)
@@ -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 {