Bug 375259 - The directory service shouldn't return an uninitialized (safely) nsILocalFile for the "Drivs" key. r=bsmedberg 11 years ago
authorJeff Walden <jwalden@mit.edu>
Mon, 05 Mar 2018 13:02:25 -0800
changeset 461864 353bb6fbb68354a90173f5b9a9188b6de756d8e0
parent 461863 63a48ae95dd8c9259e5cdbe9030f2ddc8381d3a5
child 461865 9581711718570bc55ce69f4eb397f462ab0a639e
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs375259
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 375259 - The directory service shouldn't return an uninitialized (safely) nsILocalFile for the "Drivs" key. r=bsmedberg 11 years ago
xpcom/io/SpecialSystemDirectory.cpp
--- a/xpcom/io/SpecialSystemDirectory.cpp
+++ b/xpcom/io/SpecialSystemDirectory.cpp
@@ -79,16 +79,19 @@ GetWindowsFolder(int aFolder, nsIFile** 
   HRESULT result = SHGetSpecialFolderPathW(nullptr, path, aFolder, true);
 
   if (!SUCCEEDED(result)) {
     return NS_ERROR_FAILURE;
   }
 
   // Append the trailing slash
   int len = wcslen(path);
+  if (len == 0) {
+    return NS_ERROR_FILE_UNRECOGNIZED_PATH;
+  }
   if (len > 1 && path[len - 1] != L'\\') {
     path[len]   = L'\\';
     path[++len] = L'\0';
   }
 
   return NS_NewLocalFile(nsDependentString(path, len), true, aFile);
 }