]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
ShellPkg: BcfgDisplayDump(): calculate OptionalDataOffset explicitly
[mirror_edk2.git] / ShellPkg / Library / UefiShellBcfgCommandLib / UefiShellBcfgCommandLib.c
index d109ca29a781b1ac06eaf888ff633b87f805f520..ca7ecd17519f85e155f7017c3f41ed004cf4f8d6 100644 (file)
@@ -1055,6 +1055,7 @@ BcfgDisplayDump(
   EFI_LOAD_OPTION *LoadOption;\r
   CHAR16          *Description;\r
   UINTN           DescriptionSize;\r
+  UINTN           OptionalDataOffset;\r
 \r
   if (OrderCount == 0) {\r
     ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_BCFG_NONE), gShellBcfgHiiHandle, L"bcfg");  \r
@@ -1118,6 +1119,10 @@ BcfgDisplayDump(
       FilePathList = (UINT8 *)Description + DescriptionSize;\r
       DevPathString = ConvertDevicePathToText(FilePathList, TRUE, FALSE);\r
     }\r
+\r
+    OptionalDataOffset = sizeof *LoadOption + DescriptionSize +\r
+                         LoadOption->FilePathListLength;\r
+\r
     ShellPrintHiiEx(\r
       -1,\r
       -1,\r
@@ -1128,9 +1133,10 @@ BcfgDisplayDump(
       VariableName,\r
       Description,\r
       DevPathString,\r
-      (DescriptionSize + LoadOption->FilePathListLength + 6) <= BufferSize?L'N':L'Y');\r
+      OptionalDataOffset <= BufferSize ? L'N' : L'Y'\r
+      );\r
     if (VerboseOutput) {\r
-      for (LoopVar2 = (DescriptionSize + LoadOption->FilePathListLength + 6);LoopVar2<BufferSize;LoopVar2++){\r
+      for (LoopVar2 = OptionalDataOffset; LoopVar2 < BufferSize; LoopVar2++){\r
         ShellPrintEx(\r
           -1,\r
           -1,\r