From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C987E2035686A for ; Tue, 21 Nov 2017 22:31:22 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Nov 2017 22:35:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,436,1505804400"; d="scan'208";a="5078546" Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.34]) by orsmga003.jf.intel.com with ESMTP; 21 Nov 2017 22:35:36 -0800 From: Jiaxin Wu To: edk2-devel@lists.01.org Cc: Ye Ting , Fu Siyuan , Wu Jiaxin Date: Wed, 22 Nov 2017 14:35:35 +0800 Message-Id: <1511332535-5996-1-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [Patch] NetworkPkg/HttpDxe: Fix the incorrect SizeofHeaders in HttpTcpReceiveHeader(). X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Nov 2017 06:31:22 -0000 Commit 19bd133562df951ae7ff7e1fff99b11a25b4cb6d is to fix the incorrect SizeofHeaders returned from HttpTcpReceiveHeader(). But it missed the "\r\n\r\n" calculation, which will cause the later HttpHeaders parsing failure. This patch is fix the above issue. Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- NetworkPkg/HttpDxe/HttpProto.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c index 1aa1816..925281a 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -1875,13 +1875,10 @@ HttpTcpReceiveHeader ( // // Check whether we received end of HTTP headers. // *EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR); - if (*EndofHeader != NULL) { - *SizeofHeaders = *EndofHeader - *HttpHeaders; - } }; // // Free the buffer. // @@ -1977,13 +1974,10 @@ HttpTcpReceiveHeader ( // // Check whether we received end of HTTP headers. // *EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR); - if (*EndofHeader != NULL) { - *SizeofHeaders = *EndofHeader - *HttpHeaders; - } }; // // Free the buffer. // @@ -2000,11 +1994,13 @@ HttpTcpReceiveHeader ( } // // Skip the CRLF after the HTTP headers. // - *EndofHeader = *EndofHeader + AsciiStrLen (HTTP_END_OF_HDR_STR); + *EndofHeader = *EndofHeader + AsciiStrLen (HTTP_END_OF_HDR_STR); + + *SizeofHeaders = *EndofHeader - *HttpHeaders; return EFI_SUCCESS; } /** -- 1.9.5.msysgit.1