From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=zhichao.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7D60B201B045C for ; Mon, 18 Feb 2019 00:28:02 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Feb 2019 00:28:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,383,1544515200"; d="scan'208";a="125258794" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga008.fm.intel.com with ESMTP; 18 Feb 2019 00:28:02 -0800 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 18 Feb 2019 00:28:01 -0800 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 18 Feb 2019 00:28:01 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.162]) with mapi id 14.03.0415.000; Mon, 18 Feb 2019 16:27:59 +0800 From: "Gao, Zhichao" To: "edk2-devel@lists.01.org" CC: "Gao, Liming" Thread-Topic: [edk2] [PATCH] ShellPkg/Application/Shell: add array index check for shell delay option Thread-Index: AQHUxBDJDE5XfemDCECqzIWmpcaHkaXlPqfw Date: Mon, 18 Feb 2019 08:27:59 +0000 Message-ID: <3CE959C139B4C44DBEA1810E3AA6F9000B79F5CD@SHSMSX101.ccr.corp.intel.com> References: <20190214025505.4184-1-zhichao.gao@intel.com> In-Reply-To: <20190214025505.4184-1-zhichao.gao@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmVhNjU3NWYtZGEwZS00NmIzLWIxMWYtMWQyZTViOTUyODQ3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiWDBuT1VXck9WT2NNdFQzYThXRnoybTA3cUxsM2VvTzhtbTlKbUNUZDRUVDFaSUNnY0pkSlYwUmR1NGdGV2p5YyJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg/Application/Shell: add array index check for shell delay option X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2019 08:28:03 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ignore this patch. The commit massage is not in compliance with https://git= hub.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format. > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Zhichao Gao > Sent: Thursday, February 14, 2019 10:55 AM > To: edk2-devel@lists.01.org > Cc: Gao, Liming > Subject: [edk2] [PATCH] ShellPkg/Application/Shell: add array index check= for > shell delay option >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1528 > Shell delay option without parameters do not check the index of shell > parameter argv. Add index check to avoid invalid pointer references. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Zhichao Gao >=20 > Cc: Liming Gao > Cc: Ray Ni > --- > ShellPkg/Application/Shell/Shell.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) >=20 > diff --git a/ShellPkg/Application/Shell/Shell.c > b/ShellPkg/Application/Shell/Shell.c > index 104f4c8961..f4d9668d81 100644 > --- a/ShellPkg/Application/Shell/Shell.c > +++ b/ShellPkg/Application/Shell/Shell.c > @@ -1002,7 +1002,11 @@ ProcessCommandLine( > ) =3D=3D 0) { > ShellInfoObject.ShellInitSettings.BitUnion.Bits.Delay =3D T= RUE; > // Check for optional delay value following "-delay" > - DelayValueStr =3D gEfiShellParametersProtocol->Argv[LoopVar + 1]; > + if ((LoopVar + 1) >=3D gEfiShellParametersProtocol->Argc) { > + DelayValueStr =3D NULL; > + } else { > + DelayValueStr =3D gEfiShellParametersProtocol->Argv[LoopVar + 1]= ; > + } > if (DelayValueStr !=3D NULL){ > if (*DelayValueStr =3D=3D L':') { > DelayValueStr++; > -- > 2.16.2.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel