From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: jaben.carsey@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Mon, 12 Aug 2019 07:44:53 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Aug 2019 07:44:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,377,1559545200"; d="scan'208";a="327376135" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga004.jf.intel.com with ESMTP; 12 Aug 2019 07:44:52 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 12 Aug 2019 07:44:52 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.141]) by FMSMSX157.amr.corp.intel.com ([169.254.14.33]) with mapi id 14.03.0439.000; Mon, 12 Aug 2019 07:44:52 -0700 From: "Carsey, Jaben" To: "Gao, Zhichao" , "devel@edk2.groups.io" CC: "Ni, Ray" Subject: Re: [PATCH] ShellPkg/UefiShellLevel2CommansLib: Pointer Resonse should be checked Thread-Topic: [PATCH] ShellPkg/UefiShellLevel2CommansLib: Pointer Resonse should be checked Thread-Index: AQHVUKX86HPXk2kf20iryd9LAsdbsqb3l6mQ Date: Mon, 12 Aug 2019 14:44:51 +0000 Message-ID: References: <20190812003621.3476-1-zhichao.gao@intel.com> In-Reply-To: <20190812003621.3476-1-zhichao.gao@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMGRiNjBhZjMtMmJlNC00NDlhLTg2ODktNTI5ZDFkY2E2ODg3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiSllPcVBKXC90TkdhOFhtU2djNERJUDlrZVVcL21GTEJhOWhYU1pSdHZKQ01LalZNd2lDOWJlUnliVlhVY2pGTDNYIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.1.200.106] MIME-Version: 1.0 Return-Path: jaben.carsey@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey Thanks -Jaben > -----Original Message----- > From: Gao, Zhichao > Sent: Sunday, August 11, 2019 5:36 PM > To: devel@edk2.groups.io > Cc: Carsey, Jaben ; Ni, Ray > Subject: [PATCH] ShellPkg/UefiShellLevel2CommansLib: Pointer Resonse > should be checked >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2049 >=20 > 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. >=20 > If Response is NULL that indicates a EFI_OUT_OF_RESOURCES > error, directly return SHELL_ABORTED. >=20 > Cc: Jaben Carsey > Cc: Ray Ni > Signed-off-by: Zhichao Gao > --- > ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c | 5 ++++- > ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c | 5 ++++- > 2 files changed, 8 insertions(+), 2 deletions(-) >=20 > diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c > b/ShellPkg/Library/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/Library/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, > STRING_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); > -- > 2.21.0.windows.1