Fixing bug 383769. nsLocalFile::EnsureShortPath should check if GetShortPathNameW failed. r=benjamin@smedbergs.us

This commit is contained in:
jwatt@jwatt.org 2007-06-27 01:36:03 -07:00
parent dde1dded06
commit c16e1a5d68

View File

@ -2929,7 +2929,8 @@ nsLocalFile::EnsureShortPath()
WCHAR thisshort[MAX_PATH];
DWORD thisr = ::GetShortPathNameW(mWorkingPath.get(), thisshort,
sizeof(thisshort));
if (thisr < sizeof(thisshort))
// If an error occured (thisr == 0) thisshort is uninitialized memory!
if (thisr != 0 && thisr < sizeof(thisshort))
mShortWorkingPath.Assign(thisshort);
else
mShortWorkingPath.Assign(mWorkingPath);