Bug 1344921 relocate initialization (and declaration) of variable to not allow a jump to bypass it draft
authorTom Ritter <tom@mozilla.com>
Thu, 23 Mar 2017 14:56:54 -0500
changeset 503917 b145fa2f01c9bcdf8ccf58cacf52ea4d651d764a
parent 503905 f5c7d2da47a9c58f75b1e41528dee20697c1f020
child 550549 fee3797f974e23ec4343736861f747f651a0d95b
push id50706
push userbmo:tom@mozilla.com
push dateThu, 23 Mar 2017 19:57:24 +0000
bugs1344921
milestone55.0a1
Bug 1344921 relocate initialization (and declaration) of variable to not allow a jump to bypass it MozReview-Commit-ID: LouiRkuCAqb
mozglue/build/WindowsDllBlocklist.cpp
--- a/mozglue/build/WindowsDllBlocklist.cpp
+++ b/mozglue/build/WindowsDllBlocklist.cpp
@@ -530,16 +530,18 @@ patched_LdrLoadDll (PWCHAR filePath, PUL
   char dllName[DLLNAME_MAX+1];
   wchar_t *dll_part;
   char *dot;
 
   int len = moduleFileName->Length / 2;
   wchar_t *fname = moduleFileName->Buffer;
   UniquePtr<wchar_t[]> full_fname;
 
+  const DllBlockInfo* info = &sWindowsDllBlocklist[0];
+
   // The filename isn't guaranteed to be null terminated, but in practice
   // it always will be; ensure that this is so, and bail if not.
   // This is done instead of the more robust approach because of bug 527122,
   // where lots of weird things were happening when we tried to make a copy.
   if (moduleFileName->MaximumLength < moduleFileName->Length+2 ||
       fname[len] != 0)
   {
 #ifdef DEBUG
@@ -610,17 +612,16 @@ patched_LdrLoadDll (PWCHAR filePath, PUL
       current++;
     }
     if (current == dot) {
       return STATUS_DLL_NOT_FOUND;
     }
   }
 
   // then compare to everything on the blocklist
-  const DllBlockInfo* info = &sWindowsDllBlocklist[0];
   while (info->name) {
     if (strcmp(info->name, dllName) == 0)
       break;
 
     info++;
   }
 
   if (info->name) {