Bug 1350309 - Fix uninitialized variables in updatehelper.cpp draft
authorXiaoyin Liu <xiaoyin.l@outlook.com>
Fri, 24 Mar 2017 08:58:42 -0400
changeset 504550 aaedba1925b148ed1ef744d37f579ad86218ae41
parent 501891 146751ba88f6dde8972b83ed262bae517fa2459e
child 550676 ad2d6a25567f3bf5fe8bf6e879b945323d094b1e
push id50823
push userbmo:xiaoyin.l@outlook.com
push dateFri, 24 Mar 2017 13:01:38 +0000
bugs1350309
milestone55.0a1
Bug 1350309 - Fix uninitialized variables in updatehelper.cpp Originally |consent| and |secureDesktop| are always used even when |success| is FALSE, and |consent| and |secureDesktop| are uninitialized in this case. In this patch, |isUnpromptedElevation| is set only when |success| is TRUE. MozReview-Commit-ID: Dik8NG7zcCa
toolkit/mozapps/update/common/updatehelper.cpp
--- a/toolkit/mozapps/update/common/updatehelper.cpp
+++ b/toolkit/mozapps/update/common/updatehelper.cpp
@@ -595,13 +595,16 @@ IsUnpromptedElevation(BOOL &isUnprompted
     return FALSE;
   }
 
   DWORD consent, secureDesktop;
   BOOL success = GetDWORDValue(baseKey, L"ConsentPromptBehaviorAdmin",
                                consent);
   success = success &&
             GetDWORDValue(baseKey, L"PromptOnSecureDesktop", secureDesktop);
-  isUnpromptedElevation = !consent && !secureDesktop;
 
   RegCloseKey(baseKey);
+  if (success) {
+    isUnpromptedElevation = !consent && !secureDesktop;
+  }
+
   return success;
 }