зеркало из https://github.com/mozilla/gecko-dev.git
fix for #63186, crash in subscribe dialog. the UW IMAP server
is sending us folders names that aren't modified UTF7 and this causes us to crash. also fix a warning. r=jgmyers,sr=bienvenu,a=brendan
This commit is contained in:
Родитель
3e57841b59
Коммит
8d258feb5a
|
@ -107,7 +107,8 @@ nsImapIncomingServer::nsImapIncomingServer()
|
|||
|
||||
nsImapIncomingServer::~nsImapIncomingServer()
|
||||
{
|
||||
nsresult rv = ClearInner();
|
||||
nsresult rv;
|
||||
rv = ClearInner();
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "ClearInner failed");
|
||||
|
||||
CloseCachedConnections();
|
||||
|
@ -2372,7 +2373,25 @@ nsImapIncomingServer::AddTo(const char *aName, PRBool addAsSubscribed,PRBool cha
|
|||
{
|
||||
nsresult rv = EnsureInner();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
return mInner->AddTo(aName, addAsSubscribed, changeIfExists);
|
||||
|
||||
// quick check if the name we are passed is really modified UTF-7
|
||||
// if it isn't, ignore it. (otherwise, we'll crash. see #63186)
|
||||
// there is a bug in the UW IMAP server where it can send us
|
||||
// folder names as literals, instead of MUTF7
|
||||
unsigned char *ptr = (unsigned char *)aName;
|
||||
PRBool nameIsClean = PR_TRUE;
|
||||
while (*ptr) {
|
||||
if (*ptr > 127) {
|
||||
nameIsClean = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
|
||||
NS_ASSERTION(nameIsClean,"folder path was not in UTF7, ignore it");
|
||||
if (!nameIsClean) return NS_OK;
|
||||
|
||||
return mInner->AddTo(aName, addAsSubscribed, changeIfExists);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
Загрузка…
Ссылка в новой задаче