Bug 1111842 - Make sure QuotaManager can handle escaped URL components passed from SQLite, r=janv.

This commit is contained in:
Ben Turner 2014-12-01 16:29:27 -05:00
Родитель 413e425bf2
Коммит f2c0ff7d75
1 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -42,6 +42,7 @@
#include "nsContentUtils.h"
#include "nsCRTGlue.h"
#include "nsDirectoryServiceUtils.h"
#include "nsEscape.h"
#include "nsNetUtil.h"
#include "nsPrintfCString.h"
#include "nsScriptSecurityManager.h"
@ -1617,12 +1618,19 @@ QuotaManager::GetQuotaObject(PersistenceType aPersistenceType,
fileSize = 0;
}
// Re-escape our parameters above to make sure we get the right quota group.
nsAutoCString tempStorage1;
const nsCSubstring& group = NS_EscapeURL(aGroup, esc_Query, tempStorage1);
nsAutoCString tempStorage2;
const nsCSubstring& origin = NS_EscapeURL(aOrigin, esc_Query, tempStorage2);
nsRefPtr<QuotaObject> result;
{
MutexAutoLock lock(mQuotaMutex);
GroupInfoTriple* triple;
if (!mGroupInfoTriples.Get(aGroup, &triple)) {
if (!mGroupInfoTriples.Get(group, &triple)) {
return nullptr;
}
@ -1633,7 +1641,7 @@ QuotaManager::GetQuotaObject(PersistenceType aPersistenceType,
return nullptr;
}
nsRefPtr<OriginInfo> originInfo = groupInfo->LockedGetOriginInfo(aOrigin);
nsRefPtr<OriginInfo> originInfo = groupInfo->LockedGetOriginInfo(origin);
if (!originInfo) {
return nullptr;