From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 4BFC0821E7 for ; Sun, 19 Feb 2017 19:08:35 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 19 Feb 2017 19:08:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,184,1484035200"; d="scan'208";a="50067549" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga002.jf.intel.com with ESMTP; 19 Feb 2017 19:08:34 -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.248.2; Sun, 19 Feb 2017 19:08:34 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 19 Feb 2017 19:08:34 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.20]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.177]) with mapi id 14.03.0248.002; Mon, 20 Feb 2017 11:08:33 +0800 From: "Wu, Jiaxin" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Wu, Hao A" , "Fu, Siyuan" Thread-Topic: [edk2] [PATCH] NetworkPkg/IpSecDxe: Add check to avoid possible divide by zero Thread-Index: AQHSiyXTzWtnpbR1DEezVKxxZUyWqKFxNtxQ Date: Mon, 20 Feb 2017 03:08:32 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B72741629BDE2@SHSMSX103.ccr.corp.intel.com> References: <1487559758-54048-1-git-send-email-hao.a.wu@intel.com> In-Reply-To: <1487559758-54048-1-git-send-email-hao.a.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjY5OWNhNmEtNGJhYS00NTY1LTkyZmMtZTJhZjlhNzZlN2E3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImpOb29tSWFYRUVIT1ZHQ3htVTBXaFNuR2tTSFVBeThpaFdydEdrQldvSVE9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] NetworkPkg/IpSecDxe: Add check to avoid possible divide by zero 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: Mon, 20 Feb 2017 03:08:35 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Wu Jiaxin Thanks, Jiaxin > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Hao Wu > Sent: Monday, February 20, 2017 11:03 AM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A ; Fu, Siyuan ; > Wu, Jiaxin > Subject: [edk2] [PATCH] NetworkPkg/IpSecDxe: Add check to avoid possible > divide by zero >=20 > Cc: Wu Jiaxin > Cc: Siyuan Fu > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Hao Wu > --- > NetworkPkg/IpSecDxe/Ikev2/Utility.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) >=20 > diff --git a/NetworkPkg/IpSecDxe/Ikev2/Utility.c > b/NetworkPkg/IpSecDxe/Ikev2/Utility.c > index c365532..2ca7f3c 100644 > --- a/NetworkPkg/IpSecDxe/Ikev2/Utility.c > +++ b/NetworkPkg/IpSecDxe/Ikev2/Utility.c > @@ -2,7 +2,7 @@ > The Common operations used by IKE Exchange Process. >=20 > (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
> - Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
> + Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
>=20 > This program and the accompanying materials > are licensed and made available under the terms and conditions of the = BSD > License > @@ -2627,6 +2627,8 @@ Ikev2ChildSaParseSaPayload ( >=20 > @retval EFI_SUCCESS The operation complete successfully. > @retval EFI_INVALID_PARAMETER If NumFragments is zero. > + If the authentication algorithm given b= y HashAlgId > + cannot be found. > @retval EFI_OUT_OF_RESOURCES If the required resource can't be > allocated. > @retval Others The operation is failed. >=20 > @@ -2663,6 +2665,10 @@ Ikev2SaGenerateKey ( > LocalFragments[2].Data =3D NULL; >=20 > AuthKeyLength =3D IpSecGetHmacDigestLength (HashAlgId); > + if (AuthKeyLength =3D=3D 0) { > + return EFI_INVALID_PARAMETER; > + } > + > DigestSize =3D AuthKeyLength; > Digest =3D AllocateZeroPool (AuthKeyLength); >=20 > -- > 1.9.5.msysgit.0 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel