mirror of
https://github.com/php/php-src.git
synced 2024-11-28 04:14:26 +08:00
Yup, sizeof() includes the space for the \0
This commit is contained in:
parent
02a12b57e9
commit
c8bf165242
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user