ShellPkg/UefiShellLib: Only write value if successful conversion

The ShellConvertStringToUint64() function documentation says:
"Upon a successful return the value of the conversion."

So do not write any value if the conversion failed.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
This commit is contained in:
Tormod Volden 2024-07-24 00:03:22 +02:00 committed by mergify[bot]
parent f34a945a80
commit d63d5884d7
1 changed files with 7 additions and 5 deletions

View File

@ -4234,15 +4234,17 @@ ShellConvertStringToUint64 (
Status = InternalShellStrDecimalToUint64 (Walker, &RetVal, StopAtSpace);
}
if ((Value == NULL) && !EFI_ERROR (Status)) {
return (EFI_NOT_FOUND);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
if (Value != NULL) {
*Value = RetVal;
if (Value == NULL) {
return EFI_NOT_FOUND;
}
return (Status);
*Value = RetVal;
return EFI_SUCCESS;
}
/**