public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Fu Siyuan <siyuan.fu@intel.com>
To: edk2-devel@lists.01.org
Cc: Wu Jiaxin <jiaxin.wu@intel.com>, Ye Ting <ting.ye@intel.com>,
	Karunakar P <karunakarp@amiindia.co.in>
Subject: [Patch] NetworkPkg: Fix incorrect SizeofHeaders returned from HttpTcpReceiveHeader().
Date: Wed, 15 Nov 2017 10:45:21 +0800	[thread overview]
Message-ID: <20171115024521.27596-1-siyuan.fu@intel.com> (raw)

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



             reply	other threads:[~2017-11-15  2:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15  2:45 Fu Siyuan [this message]
2017-11-15  3:14 ` [Patch] NetworkPkg: Fix incorrect SizeofHeaders returned from HttpTcpReceiveHeader() Ye, Ting
2017-11-15  5:55 ` Wu, Jiaxin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171115024521.27596-1-siyuan.fu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox