From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0721.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe46::721]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6968D81BB4 for ; Thu, 12 Jan 2017 06:39:43 -0800 (PST) Received: from DF4PR84MB0041.NAMPRD84.PROD.OUTLOOK.COM (10.162.192.143) by DF4PR84MB0042.NAMPRD84.PROD.OUTLOOK.COM (10.162.192.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7; Thu, 12 Jan 2017 14:39:41 +0000 Received: from DF4PR84MB0041.NAMPRD84.PROD.OUTLOOK.COM ([10.162.192.143]) by DF4PR84MB0041.NAMPRD84.PROD.OUTLOOK.COM ([10.162.192.143]) with mapi id 15.01.0829.017; Thu, 12 Jan 2017 14:39:41 +0000 From: "Subramanian, Sriram" To: "Hegde, Nagaraj P" , "edk2-devel@lists.01.org" CC: "jiaxin.wu@intel.com" , "jaben.carsey@intel.com" , "ruiyu.ni@intel.com" , "lubo.zhang@intel.com" Thread-Topic: [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check Thread-Index: AQHSbIWEpLaf6DjlOk+GVpszJxwdl6E06jcw Date: Thu, 12 Jan 2017 14:39:41 +0000 Message-ID: References: <20170112033938.14220-1-nagaraj-p.hegde@hpe.com> In-Reply-To: <20170112033938.14220-1-nagaraj-p.hegde@hpe.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sriram-s@hpe.com; x-originating-ip: [49.207.61.158] x-microsoft-exchange-diagnostics: 1; DF4PR84MB0042; 7:eEGNOXpGHS1XCwr4BtZs6rkM1xhNFCV5zYXvPYalc9st/UlZY0CB3m7RYX5OSjo66o3raBT9NnuFZHtlxnO25z1eyYWhJgUqgqlFCpKoStpRCN06Tar8XGLP3t6Qt2VFP/4UTMoIcOA0G9NkwEiho6AcA8zyKtcou3tNGd375dqCD7aZLIVJv/DtDMwjS6wBSL5JRWkI86fEK63O1boMfzkdOb41NgU8WFTN3Cep77/sfKavM0yUpfWMy07nyTZY/Lk50DGsxsq+Anx1dVLFOyV71ExR6EAgtFOrCNTxT2zwqud4r9LoWUDXG3A/SQPqDOTfyhv195LpBmUONs8GkQ/bLkHKZxK75D5wgDzsDdX/OwcbUP/W7MlWbSwhkxDueyz4J3z01UvOmgRSWF4VFqig1dXaINAFN38SaXEyU7obOelwGlsVWiaSV46iFTjgk4pPhP14Tew2E9YXH9hXog== x-forefront-antispam-report: SFV:SKI; SCL:-1SFV:NSPM; SFS:(10019020)(6009001)(7916002)(39840400002)(39450400003)(39410400002)(39860400002)(39850400002)(199003)(13464003)(189002)(377454003)(305945005)(68736007)(6436002)(3280700002)(6116002)(55016002)(38730400001)(33656002)(76176999)(2906002)(101416001)(50986999)(77096006)(6506006)(54356999)(74316002)(106356001)(54906002)(3846002)(122556002)(92566002)(5001770100001)(105586002)(2900100001)(106116001)(86362001)(102836003)(97736004)(7696004)(5660300001)(3900700001)(3660700001)(2501003)(66066001)(9686003)(4326007)(8936002)(229853002)(7736002)(189998001)(81156014)(2950100002)(8676002)(81166006)(19627235001); DIR:OUT; SFP:1102; SCL:1; SRVR:DF4PR84MB0042; H:DF4PR84MB0041.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; x-ms-office365-filtering-correlation-id: a353028d-9a4b-4bb4-a22b-08d43af8d7d8 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DF4PR84MB0042; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(6072148); SRVR:DF4PR84MB0042; BCL:0; PCL:0; RULEID:; SRVR:DF4PR84MB0042; x-forefront-prvs: 018577E36E received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jan 2017 14:39:41.1609 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR84MB0042 Subject: Re: [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check 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: Thu, 12 Jan 2017 14:39:43 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Sriram Subramanian -----Original Message----- From: Hegde, Nagaraj P=20 Sent: Thursday, January 12, 2017 9:10 AM To: edk2-devel@lists.01.org Cc: jiaxin.wu@intel.com; jaben.carsey@intel.com; ruiyu.ni@intel.com; lubo.z= hang@intel.com; Subramanian, Sriram Subject: [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a mis= sing NULL check When we issue 'ifconfig6 -s auto' system hangs with an ASSERT in StrLen. in IfConfig6SetInterfaceInfo, for 'auto' case we added checks to rule out the invalid inputs like 'host', 'gw' and 'dns'. To parse through this, we do a VarArg =3D VarArg->Next but we dont check new VarArg before calling StrCmp. Fix with a check in this patch. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hegde Nagaraj P --- ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c | 27 ++++++++++-= --------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c b/Sh= ellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c index d71688e..72aaee4 100644 --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c @@ -1317,20 +1317,21 @@ IfConfig6SetInterfaceInfo ( =20 VarArg=3D VarArg->Next; =20 - if (StrCmp (VarArg->Arg, L"host") =3D=3D 0) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INV= ALID_IP_CONFIG), gShellNetwork2HiiHandle, Status); - ShellStatus =3D SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } else if (StrCmp (VarArg->Arg, L"gw") =3D=3D 0) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INV= ALID_GW_CONFIG), gShellNetwork2HiiHandle, Status); - ShellStatus =3D SHELL_INVALID_PARAMETER; - goto ON_EXIT; - } else if (StrCmp (VarArg->Arg, L"dns") =3D=3D 0) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INV= ALID_DNS_CONFIG), gShellNetwork2HiiHandle, Status); - ShellStatus =3D SHELL_INVALID_PARAMETER; - goto ON_EXIT; + if (VarArg !=3D NULL) { + if (StrCmp (VarArg->Arg, L"host") =3D=3D 0) { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_I= NVALID_IP_CONFIG), gShellNetwork2HiiHandle, Status); + ShellStatus =3D SHELL_INVALID_PARAMETER; + goto ON_EXIT; + } else if (StrCmp (VarArg->Arg, L"gw") =3D=3D 0) { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_I= NVALID_GW_CONFIG), gShellNetwork2HiiHandle, Status); + ShellStatus =3D SHELL_INVALID_PARAMETER; + goto ON_EXIT; + } else if (StrCmp (VarArg->Arg, L"dns") =3D=3D 0) { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_I= NVALID_DNS_CONFIG), gShellNetwork2HiiHandle, Status); + ShellStatus =3D SHELL_INVALID_PARAMETER; + goto ON_EXIT; + } } - } else if (StrCmp (VarArg->Arg, L"man") =3D=3D 0) { // // Set manual config policy. --=20 2.8.3.windows.1