Bug 1219369: In Windows debug builds allow write access to TEMP for logging purposes. r=tabraldes

This commit is contained in:
Bob Owen 2016-02-09 08:31:18 +00:00
Родитель ae44a4e6a3
Коммит ed46787107
1 изменённых файлов: 15 добавлений и 0 удалений

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

@ -53,6 +53,21 @@ SandboxBroker::LaunchApp(const wchar_t *aPath,
mozilla::sandboxing::ApplyLoggingPolicy(*mPolicy); mozilla::sandboxing::ApplyLoggingPolicy(*mPolicy);
} }
#if defined(DEBUG)
// Allow write access to TEMP directory in debug builds for logging purposes.
// The path from GetTempPathW can have a length up to MAX_PATH + 1, including
// the null, so we need MAX_PATH + 2, so we can add an * to the end.
wchar_t tempPath[MAX_PATH + 2];
uint32_t pathLen = ::GetTempPathW(MAX_PATH + 1, tempPath);
if (pathLen > 0) {
// GetTempPath path ends with \ and returns the length without the null.
tempPath[pathLen] = L'*';
tempPath[pathLen + 1] = L'\0';
mPolicy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES,
sandbox::TargetPolicy::FILES_ALLOW_ANY, tempPath);
}
#endif
// Ceate the sandboxed process // Ceate the sandboxed process
PROCESS_INFORMATION targetInfo = {0}; PROCESS_INFORMATION targetInfo = {0};
sandbox::ResultCode result; sandbox::ResultCode result;