зеркало из https://github.com/mozilla/pjs.git
applying Waterson's patch to bug 49108. r=neeti
This commit is contained in:
Родитель
4afb1cf616
Коммит
6173cfc310
|
@ -423,6 +423,10 @@ nsDiskCacheRecord::RetrieveInfo(void* aInfo, PRUint32 aInfoLength)
|
||||||
COPY_INT32(&mKeyLength, cur_ptr) ;
|
COPY_INT32(&mKeyLength, cur_ptr) ;
|
||||||
cur_ptr += sizeof(PRUint32) ;
|
cur_ptr += sizeof(PRUint32) ;
|
||||||
|
|
||||||
|
// poor man's attempt to detect corruption
|
||||||
|
if (mKeyLength > aInfoLength)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
// set mKey
|
// set mKey
|
||||||
mKey = NS_STATIC_CAST(char*, nsMemory::Alloc(mKeyLength*sizeof(char))) ;
|
mKey = NS_STATIC_CAST(char*, nsMemory::Alloc(mKeyLength*sizeof(char))) ;
|
||||||
if(!mKey)
|
if(!mKey)
|
||||||
|
@ -439,6 +443,10 @@ nsDiskCacheRecord::RetrieveInfo(void* aInfo, PRUint32 aInfoLength)
|
||||||
COPY_INT32(&mMetaDataLength, cur_ptr) ;
|
COPY_INT32(&mMetaDataLength, cur_ptr) ;
|
||||||
cur_ptr += sizeof(PRUint32) ;
|
cur_ptr += sizeof(PRUint32) ;
|
||||||
|
|
||||||
|
// poor man's attempt to detect corruption
|
||||||
|
if (mMetaDataLength > aInfoLength)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
// set mMetaData
|
// set mMetaData
|
||||||
mMetaData = NS_STATIC_CAST(char*, nsMemory::Alloc(mMetaDataLength*sizeof(char))) ;
|
mMetaData = NS_STATIC_CAST(char*, nsMemory::Alloc(mMetaDataLength*sizeof(char))) ;
|
||||||
if(!mMetaData)
|
if(!mMetaData)
|
||||||
|
@ -451,6 +459,10 @@ nsDiskCacheRecord::RetrieveInfo(void* aInfo, PRUint32 aInfoLength)
|
||||||
COPY_INT32(&name_len, cur_ptr) ;
|
COPY_INT32(&name_len, cur_ptr) ;
|
||||||
cur_ptr += sizeof(PRUint32) ;
|
cur_ptr += sizeof(PRUint32) ;
|
||||||
|
|
||||||
|
// poor man's attempt to detect corruption
|
||||||
|
if (name_len > aInfoLength)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
// get mFile native name
|
// get mFile native name
|
||||||
file_url = NS_STATIC_CAST(char*, nsMemory::Alloc(name_len*sizeof(char))) ;
|
file_url = NS_STATIC_CAST(char*, nsMemory::Alloc(name_len*sizeof(char))) ;
|
||||||
if(!file_url)
|
if(!file_url)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче