summaryrefslogtreecommitdiff
path: root/NetworkPkg
diff options
context:
space:
mode:
authorZhang Lubo <lubo.zhang@intel.com>2015-12-21 07:20:40 +0000
committervanjeff <vanjeff@Edk2>2015-12-21 07:20:40 +0000
commit172f71a497ab3db32079326aa915a4c139ef4866 (patch)
treef0922294dbb0f4e6190afa42e8188752dffd1ffc /NetworkPkg
parentfa8accd5cc1417cac84ee05456f824f6f24d2f04 (diff)
downloadedk2-platforms-172f71a497ab3db32079326aa915a4c139ef4866.tar.xz
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 <lubo.zhang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@19428 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'NetworkPkg')
-rw-r--r--NetworkPkg/HttpDxe/HttpImpl.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index 0fa437dc32..aee3de517f 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -778,6 +778,8 @@ HttpBodyParserCallback (
)
{
HTTP_TOKEN_WRAP *Wrap;
+ UINTN BodyLength;
+ CHAR8 *Body;
if (EventType != BodyParseEventOnComplete) {
return EFI_SUCCESS;
@@ -788,7 +790,14 @@ HttpBodyParserCallback (
}
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.