From nobody Tue May 7 16:03:43 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1490668026447122.19272025155817; Mon, 27 Mar 2017 19:27:06 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1667821A18AAA; Mon, 27 Mar 2017 19:27:05 -0700 (PDT) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 CB01E21A18AA9 for ; Mon, 27 Mar 2017 19:27:03 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2017 19:27:03 -0700 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.25]) by orsmga003.jf.intel.com with ESMTP; 27 Mar 2017 19:27:02 -0700 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490668023; x=1522204023; h=from:to:cc:subject:date:message-id; bh=49FQmos++uDqfwjkDezCqceav6VMSEbs8NJ9USNdWiM=; b=cPGoNOUC/6S2DaMQ++84/MPY8T0grSD379XIOvyUwMXCVGTuJZwQi6Au U+/uS2BcCD1PSKHTZ60mu4/MvwV4qg==; X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,234,1486454400"; d="scan'208";a="948842264" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Tue, 28 Mar 2017 10:27:00 +0800 Message-Id: <20170328022700.132784-1-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 Subject: [edk2] [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: , Cc: Hao A Wu MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Hao A Wu Reviewed-by: Hao Wu --- ShellPkg/Application/Shell/Shell.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shel= l/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) { =20 StartupScriptPath =3D StrnCatGrow (&StartupScriptPath, &Size, MapName,= 0); + if (StartupScriptPath =3D=3D NULL) { + // + // Do not locate the startup script in sys path when out of resource. + // + return NULL; + } TempSpot =3D StrStr (StartupScriptPath, L";"); if (TempSpot !=3D NULL) { *TempSpot =3D CHAR_NULL; --=20 2.9.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel