From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 49F8581C2E for ; Thu, 12 Jan 2017 17:43:51 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP; 12 Jan 2017 17:43:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,220,1477983600"; d="scan'208";a="212784672" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga004.fm.intel.com with ESMTP; 12 Jan 2017 17:43:51 -0800 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 12 Jan 2017 17:43:50 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 12 Jan 2017 17:43:50 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.20]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0248.002; Fri, 13 Jan 2017 09:43:48 +0800 From: "Wu, Jiaxin" To: "Subramanian, Sriram" , "Hegde, Nagaraj P" , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" , "Ni, Ruiyu" , "Zhang, Lubo" Thread-Topic: [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check Thread-Index: AQHSbIWG0JQfn/tf4U6BT1a7LmiKPKE0ZEOAgAE/e1A= Date: Fri, 13 Jan 2017 01:43:46 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B72741629384D@SHSMSX103.ccr.corp.intel.com> References: <20170112033938.14220-1-nagaraj-p.hegde@hpe.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTdmNjNlNDItNzlkMC00Y2M5LTkwYmYtMjcwZjAwZjM0OWYzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImRcL1JQXC9NbnA5Wm81K2lXdXZuczJDMXViN0JZZURcL1ZcL3R2Q1hJdnJrbE1rPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 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: Fri, 13 Jan 2017 01:43:51 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Commit: https://github.com/tianocore/edk2/commit/521981ee7608b75b51693ea367c9e1d836= 87d110 Thanks, Jiaxin > -----Original Message----- > From: Subramanian, Sriram [mailto:sriram-s@hpe.com] > Sent: Thursday, January 12, 2017 10:40 PM > To: Hegde, Nagaraj P ; edk2-devel@lists.01.org > Cc: Wu, Jiaxin ; Carsey, Jaben ; > Ni, Ruiyu ; Zhang, Lubo > Subject: RE: [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of= a > missing NULL check >=20 > Reviewed-by: Sriram Subramanian >=20 > -----Original Message----- > From: Hegde, Nagaraj P > 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.zhang@intel.com; Subramanian, Sriram > Subject: [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a > missing NULL check >=20 > 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. >=20 > 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(-) >=20 > diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c > b/ShellPkg/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_INVALID_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_INVALID_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_INVALID_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_INVALID_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_INVALID_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_INVALID_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. > -- > 2.8.3.windows.1 >=20