summaryrefslogtreecommitdiffstats
path: root/NetworkPkg
diff options
context:
space:
mode:
authorFu Siyuan <siyuan.fu@intel.com>2017-11-15 10:42:17 +0800
committerFu Siyuan <siyuan.fu@intel.com>2017-11-16 14:08:54 +0800
commit19bd133562df951ae7ff7e1fff99b11a25b4cb6d (patch)
treecdc052918e8d388eb7a2303fdf57f5e96bf979e2 /NetworkPkg
parentfca04738c94394277725a3ede6da9e887d6fae12 (diff)
downloadedk2-19bd133562df951ae7ff7e1fff99b11a25b4cb6d.tar.gz
edk2-19bd133562df951ae7ff7e1fff99b11a25b4cb6d.tar.bz2
edk2-19bd133562df951ae7ff7e1fff99b11a25b4cb6d.zip
NetworkPkg: Fix incorrect SizeofHeaders returned from HttpTcpReceiveHeader().
This patch is to fix a bug that the HttpTcpReceiveHeader() may return incorrect SizeofHeaders, which will include some already received message-body. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
Diffstat (limited to 'NetworkPkg')
-rw-r--r--NetworkPkg/HttpDxe/HttpProto.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c
index ab00f3d6f2..1aa1816c52 100644
--- a/NetworkPkg/HttpDxe/HttpProto.c
+++ b/NetworkPkg/HttpDxe/HttpProto.c
@@ -1876,7 +1876,10 @@ HttpTcpReceiveHeader (
//
// Check whether we received end of HTTP headers.
//
- *EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR);
+ *EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR);
+ if (*EndofHeader != NULL) {
+ *SizeofHeaders = *EndofHeader - *HttpHeaders;
+ }
};
//
@@ -1976,6 +1979,9 @@ HttpTcpReceiveHeader (
// Check whether we received end of HTTP headers.
//
*EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR);
+ if (*EndofHeader != NULL) {
+ *SizeofHeaders = *EndofHeader - *HttpHeaders;
+ }
};
//