[edk2-devel] [PATCH] ShellPkg: Multiple Coverity issues were found from EDK2 ShellPkg.

Kalaivani P via groups.io posted 1 patch 1 year, 4 months ago
Failed in applying to current master (apply log)
ShellPkg/Application/Shell/ShellProtocol.c   |  5 ++++-
ShellPkg/Library/UefiShellLib/UefiShellLib.c | 11 ++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
[edk2-devel] [PATCH] ShellPkg: Multiple Coverity issues were found from EDK2 ShellPkg.
Posted by Kalaivani P via groups.io 1 year, 4 months ago
Attached is the report for Coverity issues identified in ShellPkg based
on edk2-stable202205.

Cc: Srinivasan Mani <srinivasanm@ami.com>
Cc: Sundaresan Selvaraj <sundaresans@ami.com>
Cc: Arun k <arunk@ami.com>
Signed-off-by: Kalaivani P <kalaivanip@ami.com>
---
 ShellPkg/Application/Shell/ShellProtocol.c   |  5 ++++-
 ShellPkg/Library/UefiShellLib/UefiShellLib.c | 11 ++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
index e6d20ab164..e4ac7f9554 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -4,6 +4,7 @@


   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>

   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>

+  Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>

   Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>

   SPDX-License-Identifier: BSD-2-Clause-Patent



@@ -2524,7 +2525,9 @@ ShellSearchHandle (
               EfiShellClose (ShellInfoNode->Handle);

               ShellInfoNode->Handle = NULL;

             }

-          } else if (!EFI_ERROR (Status)) {

+

+           } else if (!EFI_ERROR (Status) && (ShellInfoNode->FullName != NULL)) {

+

             //

             // should be a file

             //

diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index a72767bd86..fd76da8ea5 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -3,6 +3,7 @@


   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>

   Copyright 2016-2018 Dell Technologies.<BR>

+  Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>

   Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>

   SPDX-License-Identifier: BSD-2-Clause-Patent



@@ -1761,6 +1762,9 @@ ShellCloseFileMetaArg (
   // ASSERT that ListHead is not NULL

   //

   ASSERT (ListHead != NULL);

+  if (ListHead == NULL) {

+    return (SHELL_INVALID_PARAMETER);

+  }



   //

   // Check for UEFI Shell 2.0 protocols

@@ -4377,9 +4381,10 @@ ShellFileHandleReadLine (
     return (EFI_INVALID_PARAMETER);

   }



-  if (Buffer == NULL) {

-    ASSERT (*Size == 0);

-  } else {

+  if ((Buffer == NULL) && (*Size != 0)) {

+    return EFI_INVALID_PARAMETER;

+  }

+  else {

     *Buffer = CHAR_NULL;

   }



--
2.36.0.windows.1
-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97783): https://edk2.groups.io/g/devel/message/97783
Mute This Topic: https://groups.io/mt/95917858/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-