diff options
author | Oliver Smith-Denny <osde@microsoft.com> | 2024-10-03 10:30:45 -0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-10-29 02:09:18 +0000 |
commit | 1d64506f05e320f47e7170fa7d69ff89a953ce7b (patch) | |
tree | 3946980f441d509e0c0c0436fa1537c9ba5218ac /ShellPkg | |
parent | 875202bf85d528fb7c63c4827cfe013b58f2870f (diff) | |
download | edk2-1d64506f05e320f47e7170fa7d69ff89a953ce7b.tar.gz edk2-1d64506f05e320f47e7170fa7d69ff89a953ce7b.tar.bz2 edk2-1d64506f05e320f47e7170fa7d69ff89a953ce7b.zip |
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>
Diffstat (limited to 'ShellPkg')
-rw-r--r-- | ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c | 4 | ||||
-rw-r--r-- | ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c b/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c index b4e88e7635..37afefd80b 100644 --- a/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c +++ b/ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c @@ -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);
diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c index 7e5c73b3da..a60d6be2d6 100644 --- a/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c @@ -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) {
|