From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 13A1E81C14 for ; Thu, 12 Jan 2017 01:31:39 -0800 (PST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP; 12 Jan 2017 01:31:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,349,1477983600"; d="scan'208";a="48083334" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga004.jf.intel.com with ESMTP; 12 Jan 2017 01:31:38 -0800 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 12 Jan 2017 01:31:38 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 12 Jan 2017 01:31:38 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.20]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.132]) with mapi id 14.03.0248.002; Thu, 12 Jan 2017 17:31:35 +0800 From: "Wu, Jiaxin" To: hegdenag , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" , "Ni, Ruiyu" , "Zhang, Lubo" , "sriram-s@hpe.com" Thread-Topic: [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check Thread-Index: AQHSbIWG0JQfn/tf4U6BT1a7LmiKPKE0lATA Date: Thu, 12 Jan 2017 09:31:34 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B727416293688@SHSMSX103.ccr.corp.intel.com> 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: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjlkZTU0NzYtMzY1ZC00NzMzLWE1MTktMTBlMzcxNzAwOGUxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlJWSmFQbWpGdUh3UkFpRHpxRnFxRGRNTGhpSEl1YTIzenF6Mlk5aUM5V1U9In0= 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: Thu, 12 Jan 2017 09:31:39 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Wu Jiaxin > -----Original Message----- > From: hegdenag [mailto:nagaraj-p.hegde@hpe.com] > Sent: Thursday, January 12, 2017 11:40 AM > To: edk2-devel@lists.01.org > Cc: Wu, Jiaxin ; Carsey, Jaben ; > Ni, Ruiyu ; Zhang, Lubo ; srira= m- > s@hpe.com > 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