From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 8DA6881728 for ; Wed, 11 Jan 2017 19:46:35 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 11 Jan 2017 19:46:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,348,1477983600"; d="scan'208";a="921583449" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga003.jf.intel.com with ESMTP; 11 Jan 2017 19:46:35 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 11 Jan 2017 19:46:34 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX103.ccr.corp.intel.com ([10.239.4.69]) with mapi id 14.03.0248.002; Thu, 12 Jan 2017 11:46:32 +0800 From: "Zhang, Lubo" To: hegdenag , "edk2-devel@lists.01.org" CC: "Wu, Jiaxin" , "Carsey, Jaben" , "Ni, Ruiyu" , "sriram-s@hpe.com" Thread-Topic: [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check Thread-Index: AQHSbIWGawrfqCUsx0aFVPxdu03Wv6E0Mz/A Date: Thu, 12 Jan 2017 03:46:31 +0000 Message-ID: <7619447B08B8F74DA4FF2A813B79803B39AF1CD3@shsmsx102.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-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 03:46:35 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Zhang Lubo > -----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