mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 688881 - Buffer overflow fix in nsDirectoryService::GetCurrentProcessDirectory. r=ehsan
This commit is contained in:
parent
8997b6070f
commit
8d63d631cb
@ -130,9 +130,10 @@ nsDirectoryService::GetCurrentProcessDirectory(nsILocalFile** aFile)
|
||||
|
||||
|
||||
#ifdef XP_WIN
|
||||
PRUnichar buf[MAX_PATH];
|
||||
if ( ::GetModuleFileNameW(0, buf, sizeof(buf)) )
|
||||
{
|
||||
PRUnichar buf[MAX_PATH + 1];
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
if (GetModuleFileNameW(0, buf, mozilla::ArrayLength(buf)) &&
|
||||
GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
|
||||
// chop off the executable name by finding the rightmost backslash
|
||||
PRUnichar* lastSlash = wcsrchr(buf, L'\\');
|
||||
if (lastSlash)
|
||||
|
Loading…
Reference in New Issue
Block a user