diff options
author | Oliver Smith-Denny <osde@microsoft.com> | 2024-10-03 10:23:33 -0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-10-29 02:09:18 +0000 |
commit | 040afc1e3be6e3d334c2483803b0470a34bced55 (patch) | |
tree | 857c69039e886a39337aac982c1c850d91b7c331 /ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c | |
parent | 2d10dc1fb5a12a186b4401ce42fdd3f38a614037 (diff) | |
download | edk2-040afc1e3be6e3d334c2483803b0470a34bced55.zip edk2-040afc1e3be6e3d334c2483803b0470a34bced55.tar.gz edk2-040afc1e3be6e3d334c2483803b0470a34bced55.tar.bz2 |
ShellPkg: UefiShellDebug1CommandsLib: CodeQL Fixes
Includes changes across the module for the following CodeQL rules:
- cpp/comparison-with-wider-type
- cpp/overflow-buffer
- cpp/redundant-null-check-param
- cpp/uselesstest
Co-authored-by: Taylor Beebe <taylor.d.beebe@gmail.com>
Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
Diffstat (limited to 'ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c')
-rw-r--r-- | ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c index d907ddd..c0e2886 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c @@ -67,14 +67,20 @@ ShellCommandRunMode ( ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetCount (Package) == 3) {
Temp = ShellCommandLineGetRawValue (Package, 1);
- if (!ShellIsHexOrDecimalNumber (Temp, FALSE, FALSE)) {
+ if (Temp == NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mode", Temp);
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ } else if (!ShellIsHexOrDecimalNumber (Temp, FALSE, FALSE)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mode", Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
}
NewCol = ShellStrToUintn (Temp);
Temp = ShellCommandLineGetRawValue (Package, 2);
- if (!ShellIsHexOrDecimalNumber (Temp, FALSE, FALSE)) {
+ if (Temp == NULL) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mode", Temp);
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ } else if (!ShellIsHexOrDecimalNumber (Temp, FALSE, FALSE)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"mode", Temp);
ShellStatus = SHELL_INVALID_PARAMETER;
}
|