ShellPkg/Library: Fix 32-bit truncation of pointer values

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4366

Update C and UNI files that are incorrectly using %x or %08x
instead of %p for pointer values.  On 64-bit systems, this is
truncating pointer values above 4GB.

In reviewing ShellPkg for this issue some unused UNI strings
with incorrect format specifiers were removed instead of being
fixed.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Michael D Kinney
2023-03-11 11:31:51 -08:00
committed by mergify[bot]
parent d2bfe28966
commit e4c1d8d231
5 changed files with 12 additions and 44 deletions

View File

@ -325,7 +325,7 @@ GetProtocolInfoString (
Status = gBS->HandleProtocol (TheHandle, ProtocolGuidArray[ProtocolIndex], &Instance);
if (!EFI_ERROR (Status)) {
StrnCatGrow (&RetVal, &Size, L"(%H", 0);
UnicodeSPrint (InstanceStr, sizeof (InstanceStr), L"%x", Instance);
UnicodeSPrint (InstanceStr, sizeof (InstanceStr), L"%p", Instance);
StrnCatGrow (&RetVal, &Size, InstanceStr, 0);
StrnCatGrow (&RetVal, &Size, L"%N)", 0);
}