Don't crash when we have "charset" but not the "=" in the buffer. b=353958 r+sr=bienvenu

git-svn-id: svn://10.0.0.236/trunk@212222 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mats.palmgren%bredband.net
2006-09-23 22:54:42 +00:00
parent 2132816133
commit ef1f8e4af9

View File

@@ -367,16 +367,11 @@ nsMsgI18NParseMetaCharset(nsFileSpec* fileSpec)
if (PL_strstr(buffer, "META") &&
PL_strstr(buffer, "HTTP-EQUIV") &&
PL_strstr(buffer, "CONTENT-TYPE") &&
PL_strstr(buffer, "CHARSET")
)
{
char *cp = PL_strstr(PL_strstr(buffer, "CHARSET"), "=") + 1;
char seps[] = " \"\'";
char *token;
char* newStr;
token = nsCRT::strtok(cp, seps, &newStr);
if (token != NULL)
{
PL_strstr(buffer, "CHARSET")) {
char *cp = PL_strstr(PL_strstr(buffer, "CHARSET"), "=");
char *newStr;
char *token = cp ? nsCRT::strtok(cp + 1, " \"\'", &newStr) : nsnull;
if (token) {
PL_strncpy(charset, token, sizeof(charset));
charset[sizeof(charset)-1] = '\0';