From nobody Fri Apr 26 22:17:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45326+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45326+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1565570190; cv=none; d=zoho.com; s=zohoarc; b=ZlAA+MPt9s3WqNy6cKna3q0fvQ8iMZ03zmXwFQ3rfcxktIvxNe4MUwQc8N8A5e/KNXtfALNTQsRE83jHx5CVXzsA2gwAYYH8ZoOVcDGmUU9mS2bkk2yCBlOPctuEy2GZOcb+X2JlHc8ec1KHMONDXGKkQ3b5ugPyFTqlBXBmXHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565570190; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=wBtnCRl7sArQW8CcdpRm7Fd7DbJ5QaNsg6G9iast4PI=; b=JdLw3PNYkcA6l5Q6uQbmyzuDUwUUBr3A2mACQ1Q5t6kfGmychCp1xdV8F/FM25nBafYYlVjEDuBmR49WTxASxh60dBvM0X+pAsfs2ncpGLO5NnnQjGYLGXGB5kIKiDFBAzy2irqP0tNXpDzwnQag9dcrW6a+L5IGz7WrE9e4Q2U= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45326+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565570190301445.2765332494479; Sun, 11 Aug 2019 17:36:30 -0700 (PDT) Return-Path: X-Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by groups.io with SMTP; Sun, 11 Aug 2019 17:36:29 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Aug 2019 17:36:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,375,1559545200"; d="scan'208";a="193842940" X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga001.fm.intel.com with ESMTP; 11 Aug 2019 17:36:27 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Jaben Carsey , Ray Ni Subject: [edk2-devel] [PATCH] ShellPkg/UefiShellLevel2CommansLib: Pointer Resonse should be checked Date: Mon, 12 Aug 2019 08:36:21 +0800 Message-Id: <20190812003621.3476-1-zhichao.gao@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhichao.gao@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565570189; bh=JOHZ0ACMf0exx2silmlchKZlQEaLql/h2uftqazfqx4=; h=Cc:Date:From:Reply-To:Subject:To; b=vEEV2xDMvxrZMbo/3jw1L7Xzf7SurdkT1H6NZ9KGwmkcIYSFRHAC5qFE43Cm0TMGQMz TT0tXhC6SNeahkBbZX2caltoUxZcb123LrNDltJ69XkViE1fAnG8o0cpsUiIBsgXhwfK7 Ishiqvd+EgAQr+JysPq7du5yhxI5rZ22lc8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2049 ShellPkg\Library\UefiShellLevel2CommandsLib\Cp.c line 104 and ShellPkg\Library\UefiShellLevel2CommandsLib\Mv.c line 640, the pointer variable Response may be a NULL pointer. So we should make sure that it isn't NULL before dereference it. If Response is NULL that indicates a EFI_OUT_OF_RESOURCES error, directly return SHELL_ABORTED. Cc: Jaben Carsey Cc: Ray Ni Signed-off-by: Zhichao Gao Reviewed-by: Jaben Carsey --- ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c | 5 ++++- ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c b/ShellPkg/Li= brary/UefiShellLevel2CommandsLib/Cp.c index 18b05b5803..4a2c2cfe64 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c @@ -2,7 +2,7 @@ Main file for cp shell level 2 function. =20 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -101,6 +101,9 @@ CopySingleFile( // possibly return based on response // if (!SilentMode) { + if (Response =3D=3D NULL) { + return SHELL_ABORTED; + } switch (*(SHELL_PROMPT_RESPONSE*)Response) { case ShellPromptResponseNo: // diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c b/ShellPkg/Li= brary/UefiShellLevel2CommandsLib/Mv.c index 8c2852d7eb..f50c1e4c20 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c @@ -2,7 +2,7 @@ Main file for mv shell level 2 function. =20 (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -637,6 +637,9 @@ ValidateAndMoveFiles( if (Response =3D=3D NULL) { ShellPromptForResponseHii(ShellPromptResponseTypeYesNoAllCancel, S= TRING_TOKEN (STR_GEN_DEST_EXIST_OVR), gShellLevel2HiiHandle, &Response); } + if (Response =3D=3D NULL) { + return SHELL_ABORTED; + } switch (*(SHELL_PROMPT_RESPONSE*)Response) { case ShellPromptResponseNo: FreePool(Response); --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45326): https://edk2.groups.io/g/devel/message/45326 Mute This Topic: https://groups.io/mt/32835761/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-