зеркало из https://github.com/mozilla/gecko-dev.git
fix potential memory trounce when syncing for offline on some imap servers, r=ducarroz, sr=sspitzer 181372
This commit is contained in:
Родитель
9928f2e24e
Коммит
2aa2f6fa6e
|
@ -398,21 +398,12 @@ NS_IMETHODIMP nsImapFlagAndUidState::GetCustomFlags(PRUint32 uid, char **customF
|
|||
nsAutoCMonitor(this);
|
||||
if (m_customFlagsHash)
|
||||
{
|
||||
nsPRUint32Key hashKey(uid);
|
||||
char *value = (char *) m_customFlagsHash->Get(&hashKey);
|
||||
nsPRUint32Key hashKey(uid);
|
||||
char *value = (char *) m_customFlagsHash->Get(&hashKey);
|
||||
if (value)
|
||||
{
|
||||
PRUint32 valueLen = 0, curStringLen = 0;
|
||||
do
|
||||
{
|
||||
curStringLen = strlen(value + valueLen) + 1;
|
||||
valueLen += curStringLen;
|
||||
}
|
||||
while (curStringLen > 1);
|
||||
|
||||
*customFlags = (char *) PR_Malloc(valueLen);
|
||||
memcpy(*customFlags, value, valueLen);
|
||||
return NS_OK;
|
||||
*customFlags = nsCRT::strdup(value);
|
||||
return (*customFlags) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
*customFlags = nsnull;
|
||||
|
|
Загрузка…
Ссылка в новой задаче