From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 21F5821A18AA9 for ; Mon, 27 Mar 2017 20:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490670580; x=1522206580; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=b0KkgLLwHkuk0ZyYQJwU7HzdblFzxCd50Q02toIEx/M=; b=I1o7WIaWJiHTIvA9+DNYqEh5RkhbUQ5FEPTuOwZn33v5e7ywYmfWnmfK iozd0lEtgs901ItSgb07czgDVrnIXg==; Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2017 20:09:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,235,1486454400"; d="scan'208";a="1112792307" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga001.jf.intel.com with ESMTP; 27 Mar 2017 20:09:39 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 27 Mar 2017 20:09:39 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.42]) by shsmsx102.ccr.corp.intel.com ([169.254.2.212]) with mapi id 14.03.0248.002; Tue, 28 Mar 2017 11:09:37 +0800 From: "Wu, Hao A" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] ShellPkg/Shell: Avoid potential null pointer deference Thread-Index: AQHSp2rSYrPwg9NQ20WLf7eYK6BW0aGpkkAQ Date: Tue, 28 Mar 2017 03:09:37 +0000 Message-ID: References: <20170328022700.132784-1-ruiyu.ni@intel.com> In-Reply-To: <20170328022700.132784-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/Shell: Avoid potential null pointer deference X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Mar 2017 03:09:40 -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: Ni, Ruiyu > Sent: Tuesday, March 28, 2017 10:27 AM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A > Subject: [PATCH] ShellPkg/Shell: Avoid potential null pointer deference >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ruiyu Ni > Cc: Hao A Wu > --- > ShellPkg/Application/Shell/Shell.c | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/ShellPkg/Application/Shell/Shell.c > b/ShellPkg/Application/Shell/Shell.c > index dfcbfb8..af8e523 100644 > --- a/ShellPkg/Application/Shell/Shell.c > +++ b/ShellPkg/Application/Shell/Shell.c > @@ -1162,6 +1162,12 @@ LocateStartupScript ( > MapName =3D ShellInfoObject.NewEfiShellProtocol->GetMapFromDevicePath > (&ImageDevicePath); > if (MapName !=3D NULL) { > StartupScriptPath =3D StrnCatGrow (&StartupScriptPath, &Size, MapNam= e, 0); > + if (StartupScriptPath =3D=3D NULL) { > + // > + // Do not locate the startup script in sys path when out of resour= ce. > + // > + return NULL; > + } > TempSpot =3D StrStr (StartupScriptPath, L";"); > if (TempSpot !=3D NULL) { > *TempSpot =3D CHAR_NULL; > -- > 2.9.0.windows.1