From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 B105F21B02822 for ; Wed, 7 Nov 2018 10:54:04 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2018 10:54:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,476,1534834800"; d="scan'208";a="106729519" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga002.jf.intel.com with ESMTP; 07 Nov 2018 10:54:04 -0800 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 7 Nov 2018 10:54:03 -0800 Received: from fmsmsx101.amr.corp.intel.com ([169.254.1.202]) by fmsmsx120.amr.corp.intel.com ([169.254.15.78]) with mapi id 14.03.0415.000; Wed, 7 Nov 2018 10:54:03 -0800 From: "Carsey, Jaben" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Wu, Hao A" , Jim Dailey Thread-Topic: [edk2] [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue Thread-Index: AQHUdn08fhDylucu4kKvqo2BDmlspqVEqYHQ Date: Wed, 7 Nov 2018 18:54:02 +0000 Message-ID: References: <20181107093637.168244-1-ruiyu.ni@intel.com> In-Reply-To: <20181107093637.168244-1-ruiyu.ni@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzJjMzcyZDUtNDYyZi00MGJhLWE1ZGYtZTJjMGNiY2UyYmVhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZ0I0YXVwU0ZYdjFBcCs2Qm5BRGVuSDNaSFVFU2tWZWdueVAxeHhDOG5BMUJqTXhsWmRydCtqUWNwaEJrekE5bSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg/ShellLib: Fix potential NULL deference issue 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: Wed, 07 Nov 2018 18:54:04 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Ruiyu Ni > Sent: Wednesday, November 07, 2018 1:37 AM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A ; Jim Dailey > Subject: [edk2] [PATCH] ShellPkg/ShellLib: Fix potential NULL deference > issue > Importance: High >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ruiyu Ni > Cc: Jim Dailey > Cc: Hao A Wu > --- > ShellPkg/Library/UefiShellLib/UefiShellLib.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) >=20 > diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c > b/ShellPkg/Library/UefiShellLib/UefiShellLib.c > index 580a1ee612..b17266d623 100644 > --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c > +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c > @@ -72,6 +72,7 @@ FullyQualifyPath( > { > CONST CHAR16 *WorkingPath; > CONST CHAR16 *InputPath; > + CHAR16 *CharPtr; > CHAR16 *InputFileSystem; > UINTN FileSystemCharCount; > CHAR16 *FullyQualifiedPath; > @@ -131,7 +132,10 @@ FullyQualifyPath( > // truncate the new path after the file system part. > // > StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath); > - *(StrStr(FullyQualifiedPath, L":") + 1) =3D CHAR_NULL; > + CharPtr =3D StrStr(FullyQualifiedPath, L":"); > + if (CharPtr !=3D NULL) { > + *(CharPtr + 1) =3D CHAR_NULL; > + } > } else { > // > // Relative path: start with the working directory and append "\= ". > -- > 2.16.1.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel