public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1 1/1] MdeModulePkg: Initialize temp variable in VarCheckPolicyLib
@ 2021-04-09 18:25 Bret Barkelew
  2021-04-09 18:33 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
  2021-04-12  2:23 ` Wu, Hao A
  0 siblings, 2 replies; 6+ messages in thread
From: Bret Barkelew @ 2021-04-09 18:25 UTC (permalink / raw)
  To: devel; +Cc: Jian J Wang, Hao A Wu

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>
---
 MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.c b/MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.c
index 14e1904e96d3..e50edb4ffc5a 100644
--- a/MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.c
+++ b/MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLib.c
@@ -216,6 +216,7 @@ VarCheckPolicyLibMmiHandler (
         DumpParamsOut->TotalSize = 0;
         DumpParamsOut->PageSize = 0;
         DumpParamsOut->HasMore = FALSE;
+        TempSize = 0;
         SubCommandStatus = DumpVariablePolicy (NULL, &TempSize);
         if (SubCommandStatus == EFI_BUFFER_TOO_SMALL && TempSize > 0) {
           mCurrentPaginationCommand = VAR_CHECK_POLICY_COMMAND_DUMP;
-- 
2.28.0.windows.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-13  1:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-09 18:25 [PATCH v1 1/1] MdeModulePkg: Initialize temp variable in VarCheckPolicyLib Bret Barkelew
2021-04-09 18:33 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2021-04-12  1:36   ` 回复: " gaoliming
2021-04-12  2:23 ` Wu, Hao A
2021-04-12 16:23   ` Bret Barkelew
2021-04-13  1:07     ` 回复: [edk2-devel] " gaoliming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox