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 <[email protected]>
Cc: Wu Jiaxin <[email protected]>
Cc: Ye Ting <[email protected]>
Cc: Karunakar P <[email protected]>
---
 NetworkPkg/HttpDxe/HttpProto.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c
index ab00f3d..1aa1816 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;
+      }
     };
 
     //
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to