public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] NetworkPkg: Fix incorrect SizeofHeaders returned from HttpTcpReceiveHeader().
@ 2017-11-15  2:45 Fu Siyuan
  2017-11-15  3:14 ` Ye, Ting
  2017-11-15  5:55 ` Wu, Jiaxin
  0 siblings, 2 replies; 3+ messages in thread
From: Fu Siyuan @ 2017-11-15  2:45 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wu Jiaxin, Ye Ting, Karunakar P

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>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Karunakar P <karunakarp@amiindia.co.in>
---
 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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-15  5:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-15  2:45 [Patch] NetworkPkg: Fix incorrect SizeofHeaders returned from HttpTcpReceiveHeader() Fu Siyuan
2017-11-15  3:14 ` Ye, Ting
2017-11-15  5:55 ` Wu, Jiaxin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox