ShellPkg: DynamicCommand: 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>
This commit is contained in:
Oliver Smith-Denny 2024-10-03 10:30:45 -07:00 committed by mergify[bot]
parent 875202bf85
commit 1d64506f05
2 changed files with 9 additions and 1 deletions

View File

@ -1815,6 +1815,10 @@ DownloadFile (
Context->Uri,
StrLen (Context->Uri)
);
if (DownloadUrl == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
}
PRINT_HII (STRING_TOKEN (STR_HTTP_DOWNLOADING), DownloadUrl);

View File

@ -395,7 +395,11 @@ RunTftp (
}
RemoteFilePath = ShellCommandLineGetRawValue (CheckPackage, 2);
ASSERT (RemoteFilePath != NULL);
if (RemoteFilePath == NULL) {
ASSERT (RemoteFilePath != NULL);
goto Error;
}
FilePathSize = StrLen (RemoteFilePath) + 1;
AsciiRemoteFilePath = AllocatePool (FilePathSize);
if (AsciiRemoteFilePath == NULL) {