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.20; helo=mga02.intel.com; envelope-from=siyuan.fu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 51B8C220D4C07 for ; Tue, 14 Nov 2017 18:46:18 -0800 (PST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Nov 2017 18:50:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,397,1505804400"; d="scan'208";a="176323627" Received: from sfu5-mobl.ccr.corp.intel.com ([10.239.192.240]) by fmsmga006.fm.intel.com with ESMTP; 14 Nov 2017 18:50:24 -0800 From: Fu Siyuan To: edk2-devel@lists.01.org Cc: Wu Jiaxin , Ye Ting , Karunakar P Date: Wed, 15 Nov 2017 10:45:21 +0800 Message-Id: <20171115024521.27596-1-siyuan.fu@intel.com> X-Mailer: git-send-email 2.13.0.windows.1 Subject: [Patch] NetworkPkg: Fix incorrect SizeofHeaders returned from 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, 15 Nov 2017 02:46:18 -0000 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 Cc: Wu Jiaxin Cc: Ye Ting Cc: Karunakar P --- 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