From e11a912aa3bd6b3ad69bb90f36f6860de33d846a Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Tue, 23 Jul 2024 23:51:13 +0200 Subject: ShellPkg/UefiShellLib: Correct check for empty string StrSize() will never return zero since it counts the terminating NULL character. An empty string will have the storage size of the terminator. Signed-off-by: Tormod Volden --- ShellPkg/Library/UefiShellLib/UefiShellLib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ShellPkg') diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index 488129801e..d053b6bb69 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -4012,7 +4012,7 @@ InternalShellStrHexToUint64 ( UINT64 Result; BOOLEAN LeadingZero; - if ((String == NULL) || (StrSize (String) == 0) || (Value == NULL)) { + if ((String == NULL) || (StrSize (String) == sizeof (*String)) || (Value == NULL)) { return (EFI_INVALID_PARAMETER); } @@ -4116,7 +4116,7 @@ InternalShellStrDecimalToUint64 ( { UINT64 Result; - if ((String == NULL) || (StrSize (String) == 0) || (Value == NULL)) { + if ((String == NULL) || (StrSize (String) == sizeof (*String)) || (Value == NULL)) { return (EFI_INVALID_PARAMETER); } -- cgit