summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source
diff options
context:
space:
mode:
authorKonstantin Aladyshev <aladyshev22@gmail.com>2022-07-18 17:43:52 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-07-24 15:21:20 +0000
commitfca5de51e1fd2f3c5ddbf5974d785f0f6b2f6c38 (patch)
treeebfab5ceaa6c8f79b5429533e0508eea8548c533 /BaseTools/Source
parentc0b7679aac90ab6c757bbc61ac4ccfa293ab14df (diff)
downloadedk2-fca5de51e1fd2f3c5ddbf5974d785f0f6b2f6c38.tar.gz
edk2-fca5de51e1fd2f3c5ddbf5974d785f0f6b2f6c38.tar.bz2
edk2-fca5de51e1fd2f3c5ddbf5974d785f0f6b2f6c38.zip
BaseTools/VolInfo: Correct EFI_SECTION_VERSION display
- Correct typo in print statement, - "BuildNumber" field is UINT16, therefore it needs "0x%04X" format modifier, - "VersionString" field is CHAR16, therefore the input data should be processed to be displayed with "%s" printf modifier. Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools/Source')
-rw-r--r--BaseTools/Source/C/VolInfo/VolInfo.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 8b6fcffa48..ed56587058 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -1676,6 +1676,7 @@ Returns:
CHAR8 *ToolInputFileName;
CHAR8 *ToolOutputFileName;
CHAR8 *UIFileName;
+ CHAR8 *VersionString;
ParsedLength = 0;
ToolInputFileName = NULL;
@@ -1816,8 +1817,14 @@ Returns:
break;
case EFI_SECTION_VERSION:
- printf (" Build Number: 0x%02X\n", *(UINT16 *)(Ptr + SectionHeaderLen));
- printf (" Version Strg: %s\n", (char*) (Ptr + SectionHeaderLen + sizeof (UINT16)));
+ printf (" Build Number: 0x%04X\n", *(UINT16 *)(Ptr + SectionHeaderLen));
+ VersionString = (CHAR8 *) malloc (UnicodeStrLen (((EFI_VERSION_SECTION *) Ptr)->VersionString) + 1);
+ if (VersionString == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return EFI_OUT_OF_RESOURCES;
+ }
+ Unicode2AsciiString (((EFI_VERSION_SECTION *) Ptr)->VersionString, VersionString);
+ printf (" Version String: %s\n", VersionString);
break;
case EFI_SECTION_COMPRESSION: