From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 9889C2194EB5C for ; Thu, 13 Apr 2017 18:54:03 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Apr 2017 18:54:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,195,1488873600"; d="scan'208";a="89047597" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga006.fm.intel.com with ESMTP; 13 Apr 2017 18:54:03 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 13 Apr 2017 18:54:03 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.117]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.224]) with mapi id 14.03.0319.002; Fri, 14 Apr 2017 09:51:54 +0800 From: "Ye, Ting" To: "Wu, Jiaxin" , "edk2-devel@lists.01.org" CC: "Zhang, Lubo" , "Fu, Siyuan" , "Wu, Jiaxin" Thread-Topic: [edk2] [Patch] NetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure Thread-Index: AQHStEHkZMkttlqijEKyXeOlCBEkT6HEGs7w Date: Fri, 14 Apr 2017 01:51:53 +0000 Message-ID: References: <1492079802-180-1-git-send-email-jiaxin.wu@intel.com> In-Reply-To: <1492079802-180-1-git-send-email-jiaxin.wu@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] NetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Apr 2017 01:54:03 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ye Ting =20 -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiax= in Wu Sent: Thursday, April 13, 2017 6:37 PM To: edk2-devel@lists.01.org Cc: Ye, Ting ; Zhang, Lubo ; Fu, S= iyuan ; Wu, Jiaxin Subject: [edk2] [Patch] NetworkPkg/HttpDxe: Fix HTTP download OS image over= 4G size failure UINT32 integer overflow will happen once the download OS image over 4G size= . This patch is to fix this issue. Cc: Ye Ting Cc: Fu Siyuan Cc: Zhang Lubo Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- NetworkPkg/HttpDxe/HttpProto.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.= c index 3d61ba2..3fda294 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -2029,24 +2029,24 @@ HttpTcpReceiveBody ( ASSERT (Tcp4 !=3D NULL); } =20 if (HttpInstance->LocalAddressIsIPv6) { Rx6Token =3D &Wrap->TcpWrap.Rx6Token; - Rx6Token ->Packet.RxData->DataLength =3D (UINT32) HttpMsg->BodyLength; - Rx6Token ->Packet.RxData->FragmentTable[0].FragmentLength =3D (UINT32)= HttpMsg->BodyLength; + Rx6Token ->Packet.RxData->DataLength =3D (UINT32) MIN (MAX_UINT32, Htt= pMsg->BodyLength); + Rx6Token ->Packet.RxData->FragmentTable[0].FragmentLength =3D=20 + (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength); Rx6Token ->Packet.RxData->FragmentTable[0].FragmentBuffer =3D (VOID *)= HttpMsg->Body; Rx6Token->CompletionToken.Status =3D EFI_NOT_READY; =20 Status =3D Tcp6->Receive (Tcp6, Rx6Token); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "Tcp6 receive failed: %r\n", Status)); return Status; } } else { Rx4Token =3D &Wrap->TcpWrap.Rx4Token; - Rx4Token->Packet.RxData->DataLength =3D (UINT32) HttpMsg->BodyLength; - Rx4Token->Packet.RxData->FragmentTable[0].FragmentLength =3D (UINT32) = HttpMsg->BodyLength; + Rx4Token->Packet.RxData->DataLength =3D (UINT32) MIN (MAX_UINT32, Http= Msg->BodyLength); + Rx4Token->Packet.RxData->FragmentTable[0].FragmentLength =3D (UINT32)= =20 + MIN (MAX_UINT32, HttpMsg->BodyLength); Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer =3D (VOID *) = HttpMsg->Body; =20 Rx4Token->CompletionToken.Status =3D EFI_NOT_READY; Status =3D Tcp4->Receive (Tcp4, Rx4Token); if (EFI_ERROR (Status)) { -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel