[edk2] [Patch] NetworkPkg: Fix incorrect SizeofHeaders returned from HttpTcpReceiveHeader().

Fu Siyuan posted 1 patch 6 years, 5 months ago
Failed in applying to current master (apply log)
NetworkPkg/HttpDxe/HttpProto.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
[edk2] [Patch] NetworkPkg: Fix incorrect SizeofHeaders returned from HttpTcpReceiveHeader().
Posted by Fu Siyuan 6 years, 5 months ago
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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] NetworkPkg: Fix incorrect SizeofHeaders returned from HttpTcpReceiveHeader().
Posted by Ye, Ting 6 years, 5 months ago
Reviewed-by: Ye Ting <ting.ye@intel.com> 

-----Original Message-----
From: Fu, Siyuan 
Sent: Wednesday, November 15, 2017 10:45 AM
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().

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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] NetworkPkg: Fix incorrect SizeofHeaders returned from HttpTcpReceiveHeader().
Posted by Wu, Jiaxin 6 years, 5 months ago
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>


> -----Original Message-----
> From: Fu, Siyuan
> Sent: Wednesday, November 15, 2017 10:45 AM
> 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().
> 
> 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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel