From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ml01.01.org (Postfix) with ESMTP id 132171A1E0B for ; Tue, 16 Aug 2016 00:37:10 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 16 Aug 2016 00:37:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,529,1464678000"; d="scan'208";a="749295907" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by FMSMGA003.fm.intel.com with ESMTP; 16 Aug 2016 00:37:08 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 16 Aug 2016 00:37:08 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 16 Aug 2016 00:37:08 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.8]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.116]) with mapi id 14.03.0248.002; Tue, 16 Aug 2016 15:37:06 +0800 From: "Wu, Hao A" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] ShellPkg/Ls: Handle the case when SearchString is NULL Thread-Index: AQHR95BugWfz3TifqEi9AUF6DmDQlaBLMpkQ Date: Tue, 16 Aug 2016 07:37:05 +0000 Message-ID: References: <20160816073253.357040-1-ruiyu.ni@intel.com> In-Reply-To: <20160816073253.357040-1-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg/Ls: Handle the case when SearchString is NULL X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 07:37:10 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Hao Wu Best Regards, Hao Wu > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ru= iyu > Ni > Sent: Tuesday, August 16, 2016 3:33 PM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A > Subject: [edk2] [PATCH] ShellPkg/Ls: Handle the case when SearchString is > NULL >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ruiyu Ni > Cc: Hao Wu > --- > ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c > b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c > index 0b80195..9b4c452 100644 > --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c > +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c > @@ -709,6 +709,11 @@ ShellCommandRunLs ( > // must split off the search part that applies to files fr= om the end of > the directory part > // > StrnCatGrow(&SearchString, NULL, FullPath, 0); > + if (SearchString =3D=3D NULL) { > + FreePool (FullPath); > + ShellCommandLineFreeVarList (Package); > + return SHELL_OUT_OF_RESOURCES; > + } > PathRemoveLastItem (FullPath); > CopyMem (SearchString, SearchString + StrLen (FullPath), S= trSize > (SearchString + StrLen (FullPath))); > } > -- > 2.9.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel