From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=ting.ye@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 70064220D4BE3 for ; Tue, 14 Nov 2017 19:10:47 -0800 (PST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Nov 2017 19:14:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,398,1505804400"; d="scan'208";a="175894871" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga005.fm.intel.com with ESMTP; 14 Nov 2017 19:14:54 -0800 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 14 Nov 2017 19:14:54 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 14 Nov 2017 19:14:53 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Wed, 15 Nov 2017 11:14:51 +0800 From: "Ye, Ting" To: "Fu, Siyuan" , "edk2-devel@lists.01.org" CC: "Wu, Jiaxin" , Karunakar P Thread-Topic: [Patch] NetworkPkg: Fix incorrect SizeofHeaders returned from HttpTcpReceiveHeader(). Thread-Index: AQHTXbx/fax+DBRQDkSD24G5fh9pSKMUxEPA Date: Wed, 15 Nov 2017 03:14:50 +0000 Message-ID: References: <20171115024521.27596-1-siyuan.fu@intel.com> In-Reply-To: <20171115024521.27596-1-siyuan.fu@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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 03:10:48 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ye Ting =20 -----Original Message----- From: Fu, Siyuan=20 Sent: Wednesday, November 15, 2017 10:45 AM To: edk2-devel@lists.01.org Cc: Wu, Jiaxin ; Ye, Ting ; Karunak= ar P Subject: [Patch] NetworkPkg: Fix incorrect SizeofHeaders returned from Http= TcpReceiveHeader(). This patch is to fix a bug that the HttpTcpReceiveHeader() may return incor= rect 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 =3D AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR);=20 + *EndofHeader =3D AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR); + if (*EndofHeader !=3D NULL) { + *SizeofHeaders =3D *EndofHeader - *HttpHeaders; + } }; =20 // @@ -1976,6 +1979,9 @@ HttpTcpReceiveHeader ( // Check whether we received end of HTTP headers. // *EndofHeader =3D AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR);=20 + if (*EndofHeader !=3D NULL) { + *SizeofHeaders =3D *EndofHeader - *HttpHeaders; + } }; =20 // -- 1.9.5.msysgit.1