Revision: 19428
          http://sourceforge.net/p/edk2/code/19428
Author:   vanjeff
Date:     2015-12-21 07:20:40 +0000 (Mon, 21 Dec 2015)
Log Message:
-----------
NetworkPkg:Fix a bug the 2nd httpboot fail issue.

Httpboot over Ipv4 or Ipv6 stack,for both Identity and chunked transfer
mode,when the last data has been parsed by HttpLib, the
HttpInstance->NextMsg pointer should point a correct location.Now after
the first successful httpboot for ipv4 or ipv6,the
HttpInstance->NextMsgpoint the character after the last byte, it may
be a bad buffer if we don't receive another HttpHeader, so if call a
2nd httpboot, the wrong NextMsg pointer will cause the httpboot fail,
so we need to check this case in HttpBodyParserCallback function in
the first http boot process.

(Sync patch r19423 from main trunk.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <[email protected]>
Reviewed-by: Fu Siyuan <[email protected]>
Reviewed-by: Ye Ting <[email protected]>
Reviewed-by: Wu Jiaxin <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/19423

Modified Paths:
--------------
    branches/UDK2015/NetworkPkg/HttpDxe/HttpImpl.c

Modified: branches/UDK2015/NetworkPkg/HttpDxe/HttpImpl.c
===================================================================
--- branches/UDK2015/NetworkPkg/HttpDxe/HttpImpl.c      2015-12-21 07:20:16 UTC 
(rev 19427)
+++ branches/UDK2015/NetworkPkg/HttpDxe/HttpImpl.c      2015-12-21 07:20:40 UTC 
(rev 19428)
@@ -778,6 +778,8 @@
   )
 {
   HTTP_TOKEN_WRAP               *Wrap;
+  UINTN                         BodyLength;
+  CHAR8                         *Body;
 
   if (EventType != BodyParseEventOnComplete) {
     return EFI_SUCCESS;
@@ -788,7 +790,14 @@
   }
 
   Wrap = (HTTP_TOKEN_WRAP *) Context;
-  Wrap->HttpInstance->NextMsg = Data;
+  Body = Wrap->HttpToken->Message->Body;
+  BodyLength = Wrap->HttpToken->Message->BodyLength;
+  if (Data < Body + BodyLength) {
+    Wrap->HttpInstance->NextMsg = Data;
+  } else {
+    Wrap->HttpInstance->NextMsg = NULL;
+  }
+  
 
   //
   // Free Tx4Token or Tx6Token since already received corrsponding HTTP 
response.


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to