Need room for the \0 here to avoid an overflow

This commit is contained in:
Rasmus Lerdorf 2002-08-01 07:49:53 +00:00
parent 4f5bd6b7d4
commit 7b9036cada

View 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);
int len = strlen(mimetype) + sizeof("; charset=") + strlen(charset)+1;
content_type = emalloc(len);
snprintf(content_type, len, "%s; charset=%s", mimetype, charset);
} else {