зеркало из https://github.com/mozilla/gecko-dev.git
Put pointer test around smprintf to prevent crash for invalid IMG links.
b=40094,r=adamlock,approved valeski
This commit is contained in:
Родитель
2af7bba123
Коммит
c21b74ff21
|
@ -1259,11 +1259,13 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
NS_ConvertASCIItoUCS2("dnsNotFound").GetUnicode(),
|
||||
getter_Copies(messageStr)), NS_ERROR_FAILURE);
|
||||
|
||||
PRUnichar *msg = nsTextFormatter::smprintf(messageStr, (const char*)host);
|
||||
if (!msg) return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (host) {
|
||||
PRUnichar *msg = nsTextFormatter::smprintf(messageStr, (const char*)host);
|
||||
if (!msg) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
prompter->Alert(nsnull, msg);
|
||||
nsTextFormatter::smprintf_free(msg);
|
||||
prompter->Alert(nsnull, msg);
|
||||
nsTextFormatter::smprintf_free(msg);
|
||||
}
|
||||
}
|
||||
else if(aStatus == NS_ERROR_CONNECTION_REFUSED)
|
||||
{// Doc failed to load because we couldn't connect to the server.
|
||||
|
|
|
@ -1259,11 +1259,13 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
NS_ConvertASCIItoUCS2("dnsNotFound").GetUnicode(),
|
||||
getter_Copies(messageStr)), NS_ERROR_FAILURE);
|
||||
|
||||
PRUnichar *msg = nsTextFormatter::smprintf(messageStr, (const char*)host);
|
||||
if (!msg) return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (host) {
|
||||
PRUnichar *msg = nsTextFormatter::smprintf(messageStr, (const char*)host);
|
||||
if (!msg) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
prompter->Alert(nsnull, msg);
|
||||
nsTextFormatter::smprintf_free(msg);
|
||||
prompter->Alert(nsnull, msg);
|
||||
nsTextFormatter::smprintf_free(msg);
|
||||
}
|
||||
}
|
||||
else if(aStatus == NS_ERROR_CONNECTION_REFUSED)
|
||||
{// Doc failed to load because we couldn't connect to the server.
|
||||
|
|
Загрузка…
Ссылка в новой задаче