summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ShellPkg/Library/UefiShellLib/UefiShellLib.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index f023505300..488129801e 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -4009,7 +4009,8 @@ InternalShellStrHexToUint64 (
IN CONST BOOLEAN StopAtSpace
)
{
- UINT64 Result;
+ UINT64 Result;
+ BOOLEAN LeadingZero;
if ((String == NULL) || (StrSize (String) == 0) || (Value == NULL)) {
return (EFI_INVALID_PARAMETER);
@@ -4025,12 +4026,14 @@ InternalShellStrHexToUint64 (
//
// Ignore leading Zeros after the spaces
//
+ LeadingZero = FALSE;
while (*String == L'0') {
String++;
+ LeadingZero = TRUE;
}
if (CharToUpper (*String) == L'X') {
- if (*(String - 1) != L'0') {
+ if (!LeadingZero) {
return 0;
}