]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Initialize temp variable in VarCheckPolicyLib
authorBret Barkelew <bret@corthon.com>
Fri, 9 Apr 2021 18:25:11 +0000 (02:25 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 13 Apr 2021 01:24:13 +0000 (01:24 +0000)
DumpVariablePolicy() will return EFI_INVALID_PARAMETER if the Buffer
pointer is NULL and the indirect Size is anything but 0. Since this
TempSize was not being initialized it is very likely that this sequence
would not return the total buffer size as expected.

Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=3310

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Bret Barkelew <bret.barkelew@microsoft.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.c

index 14e1904e96d366106053a0ca4058d79918ea0114..e50edb4ffc5acecbc1f2c0ca0f3630d65037abb2 100644 (file)
@@ -216,6 +216,7 @@ VarCheckPolicyLibMmiHandler (
         DumpParamsOut->TotalSize = 0;\r
         DumpParamsOut->PageSize = 0;\r
         DumpParamsOut->HasMore = FALSE;\r
+        TempSize = 0;\r
         SubCommandStatus = DumpVariablePolicy (NULL, &TempSize);\r
         if (SubCommandStatus == EFI_BUFFER_TOO_SMALL && TempSize > 0) {\r
           mCurrentPaginationCommand = VAR_CHECK_POLICY_COMMAND_DUMP;\r