* [Patch] NetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure
@ 2017-04-13 10:36 Jiaxin Wu
2017-04-14 0:51 ` Fu, Siyuan
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jiaxin Wu @ 2017-04-13 10:36 UTC (permalink / raw)
To: edk2-devel; +Cc: Ye Ting, Fu Siyuan, Zhang Lubo, Wu Jiaxin
UINT32 integer overflow will happen once the download OS image over
4G size. This patch is to fix this issue.
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
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 != NULL);
}
if (HttpInstance->LocalAddressIsIPv6) {
Rx6Token = &Wrap->TcpWrap.Rx6Token;
- Rx6Token ->Packet.RxData->DataLength = (UINT32) HttpMsg->BodyLength;
- Rx6Token ->Packet.RxData->FragmentTable[0].FragmentLength = (UINT32) HttpMsg->BodyLength;
+ Rx6Token ->Packet.RxData->DataLength = (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength);
+ Rx6Token ->Packet.RxData->FragmentTable[0].FragmentLength = (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength);
Rx6Token ->Packet.RxData->FragmentTable[0].FragmentBuffer = (VOID *) HttpMsg->Body;
Rx6Token->CompletionToken.Status = EFI_NOT_READY;
Status = Tcp6->Receive (Tcp6, Rx6Token);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Tcp6 receive failed: %r\n", Status));
return Status;
}
} else {
Rx4Token = &Wrap->TcpWrap.Rx4Token;
- Rx4Token->Packet.RxData->DataLength = (UINT32) HttpMsg->BodyLength;
- Rx4Token->Packet.RxData->FragmentTable[0].FragmentLength = (UINT32) HttpMsg->BodyLength;
+ Rx4Token->Packet.RxData->DataLength = (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength);
+ Rx4Token->Packet.RxData->FragmentTable[0].FragmentLength = (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength);
Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer = (VOID *) HttpMsg->Body;
Rx4Token->CompletionToken.Status = EFI_NOT_READY;
Status = Tcp4->Receive (Tcp4, Rx4Token);
if (EFI_ERROR (Status)) {
--
1.9.5.msysgit.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Patch] NetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure
2017-04-13 10:36 [Patch] NetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure Jiaxin Wu
@ 2017-04-14 0:51 ` Fu, Siyuan
2017-04-14 1:51 ` Ye, Ting
2017-04-17 3:17 ` Subramanian, Sriram
2 siblings, 0 replies; 4+ messages in thread
From: Fu, Siyuan @ 2017-04-14 0:51 UTC (permalink / raw)
To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Ye, Ting, Zhang, Lubo, Wu, Jiaxin
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiaxin Wu
Sent: 2017年4月13日 18:37
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting.ye@intel.com>; Zhang, Lubo <lubo.zhang@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
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 <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
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 != NULL);
}
if (HttpInstance->LocalAddressIsIPv6) {
Rx6Token = &Wrap->TcpWrap.Rx6Token;
- Rx6Token ->Packet.RxData->DataLength = (UINT32) HttpMsg->BodyLength;
- Rx6Token ->Packet.RxData->FragmentTable[0].FragmentLength = (UINT32) HttpMsg->BodyLength;
+ Rx6Token ->Packet.RxData->DataLength = (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength);
+ Rx6Token ->Packet.RxData->FragmentTable[0].FragmentLength =
+ (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength);
Rx6Token ->Packet.RxData->FragmentTable[0].FragmentBuffer = (VOID *) HttpMsg->Body;
Rx6Token->CompletionToken.Status = EFI_NOT_READY;
Status = Tcp6->Receive (Tcp6, Rx6Token);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Tcp6 receive failed: %r\n", Status));
return Status;
}
} else {
Rx4Token = &Wrap->TcpWrap.Rx4Token;
- Rx4Token->Packet.RxData->DataLength = (UINT32) HttpMsg->BodyLength;
- Rx4Token->Packet.RxData->FragmentTable[0].FragmentLength = (UINT32) HttpMsg->BodyLength;
+ Rx4Token->Packet.RxData->DataLength = (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength);
+ Rx4Token->Packet.RxData->FragmentTable[0].FragmentLength = (UINT32)
+ MIN (MAX_UINT32, HttpMsg->BodyLength);
Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer = (VOID *) HttpMsg->Body;
Rx4Token->CompletionToken.Status = EFI_NOT_READY;
Status = 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch] NetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure
2017-04-13 10:36 [Patch] NetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure Jiaxin Wu
2017-04-14 0:51 ` Fu, Siyuan
@ 2017-04-14 1:51 ` Ye, Ting
2017-04-17 3:17 ` Subramanian, Sriram
2 siblings, 0 replies; 4+ messages in thread
From: Ye, Ting @ 2017-04-14 1:51 UTC (permalink / raw)
To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Zhang, Lubo, Fu, Siyuan, Wu, Jiaxin
Reviewed-by: Ye Ting <ting.ye@intel.com>
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiaxin Wu
Sent: Thursday, April 13, 2017 6:37 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting.ye@intel.com>; Zhang, Lubo <lubo.zhang@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
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 <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
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 != NULL);
}
if (HttpInstance->LocalAddressIsIPv6) {
Rx6Token = &Wrap->TcpWrap.Rx6Token;
- Rx6Token ->Packet.RxData->DataLength = (UINT32) HttpMsg->BodyLength;
- Rx6Token ->Packet.RxData->FragmentTable[0].FragmentLength = (UINT32) HttpMsg->BodyLength;
+ Rx6Token ->Packet.RxData->DataLength = (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength);
+ Rx6Token ->Packet.RxData->FragmentTable[0].FragmentLength =
+ (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength);
Rx6Token ->Packet.RxData->FragmentTable[0].FragmentBuffer = (VOID *) HttpMsg->Body;
Rx6Token->CompletionToken.Status = EFI_NOT_READY;
Status = Tcp6->Receive (Tcp6, Rx6Token);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Tcp6 receive failed: %r\n", Status));
return Status;
}
} else {
Rx4Token = &Wrap->TcpWrap.Rx4Token;
- Rx4Token->Packet.RxData->DataLength = (UINT32) HttpMsg->BodyLength;
- Rx4Token->Packet.RxData->FragmentTable[0].FragmentLength = (UINT32) HttpMsg->BodyLength;
+ Rx4Token->Packet.RxData->DataLength = (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength);
+ Rx4Token->Packet.RxData->FragmentTable[0].FragmentLength = (UINT32)
+ MIN (MAX_UINT32, HttpMsg->BodyLength);
Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer = (VOID *) HttpMsg->Body;
Rx4Token->CompletionToken.Status = EFI_NOT_READY;
Status = 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch] NetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure
2017-04-13 10:36 [Patch] NetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure Jiaxin Wu
2017-04-14 0:51 ` Fu, Siyuan
2017-04-14 1:51 ` Ye, Ting
@ 2017-04-17 3:17 ` Subramanian, Sriram
2 siblings, 0 replies; 4+ messages in thread
From: Subramanian, Sriram @ 2017-04-17 3:17 UTC (permalink / raw)
To: Jiaxin Wu, edk2-devel@lists.01.org; +Cc: Ye Ting, Zhang Lubo, Fu Siyuan
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiaxin Wu
Sent: Thursday, April 13, 2017 4:07 PM
To: edk2-devel@lists.01.org
Cc: Ye Ting <ting.ye@intel.com>; Zhang Lubo <lubo.zhang@intel.com>; Fu Siyuan <siyuan.fu@intel.com>; Wu Jiaxin <jiaxin.wu@intel.com>
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 <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
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 != NULL);
}
if (HttpInstance->LocalAddressIsIPv6) {
Rx6Token = &Wrap->TcpWrap.Rx6Token;
- Rx6Token ->Packet.RxData->DataLength = (UINT32) HttpMsg->BodyLength;
- Rx6Token ->Packet.RxData->FragmentTable[0].FragmentLength = (UINT32) HttpMsg->BodyLength;
+ Rx6Token ->Packet.RxData->DataLength = (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength);
+ Rx6Token ->Packet.RxData->FragmentTable[0].FragmentLength = (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength);
Rx6Token ->Packet.RxData->FragmentTable[0].FragmentBuffer = (VOID *) HttpMsg->Body;
Rx6Token->CompletionToken.Status = EFI_NOT_READY;
Status = Tcp6->Receive (Tcp6, Rx6Token);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Tcp6 receive failed: %r\n", Status));
return Status;
}
} else {
Rx4Token = &Wrap->TcpWrap.Rx4Token;
- Rx4Token->Packet.RxData->DataLength = (UINT32) HttpMsg->BodyLength;
- Rx4Token->Packet.RxData->FragmentTable[0].FragmentLength = (UINT32) HttpMsg->BodyLength;
+ Rx4Token->Packet.RxData->DataLength = (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength);
+ Rx4Token->Packet.RxData->FragmentTable[0].FragmentLength = (UINT32) MIN (MAX_UINT32, HttpMsg->BodyLength);
Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer = (VOID *) HttpMsg->Body;
Rx4Token->CompletionToken.Status = EFI_NOT_READY;
Status = 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
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-04-17 3:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-13 10:36 [Patch] NetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure Jiaxin Wu
2017-04-14 0:51 ` Fu, Siyuan
2017-04-14 1:51 ` Ye, Ting
2017-04-17 3:17 ` Subramanian, Sriram
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox