From nobody Wed May 1 01:49:38 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1487559764954647.7370019933322; Sun, 19 Feb 2017 19:02:44 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 596DA821E2; Sun, 19 Feb 2017 19:02:43 -0800 (PST) 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 025CE821E1 for ; Sun, 19 Feb 2017 19:02:41 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 19 Feb 2017 19:02:41 -0800 Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.13]) by fmsmga004.fm.intel.com with ESMTP; 19 Feb 2017 19:02:40 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,184,1484035200"; d="scan'208";a="227326335" From: Hao Wu To: edk2-devel@lists.01.org Date: Mon, 20 Feb 2017 11:02:38 +0800 Message-Id: <1487559758-54048-1-git-send-email-hao.a.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.0 Subject: [edk2] [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: , Cc: Hao Wu , Siyuan Fu , Wu Jiaxin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Wu Jiaxin Cc: Siyuan Fu Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu Reviewed-by: Fu Siyuan Reviewed-by: Wu Jiaxin --- NetworkPkg/IpSecDxe/Ikev2/Utility.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/NetworkPkg/IpSecDxe/Ikev2/Utility.c b/NetworkPkg/IpSecDxe/Ikev= 2/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 BS= D 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 by = HashAlgId + cannot be found. @retval EFI_OUT_OF_RESOURCES If the required resource can't be allocat= ed. @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 --=20 1.9.5.msysgit.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel