mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 10:25:01 +00:00
fix potential memory trounce when syncing for offline on some imap servers, r=ducarroz, sr=sspitzer 181372
This commit is contained in:
parent
9928f2e24e
commit
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;
|
||||
|
Loading…
Reference in New Issue
Block a user