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.100; helo=mga07.intel.com; envelope-from=ting.ye@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 E692122423830 for ; Wed, 28 Feb 2018 22:44:42 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Feb 2018 22:50:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,407,1515484800"; d="scan'208";a="33766301" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga004.fm.intel.com with ESMTP; 28 Feb 2018 22:50:50 -0800 Received: from fmsmsx121.amr.corp.intel.com (10.18.125.36) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 28 Feb 2018 22:50:49 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx121.amr.corp.intel.com (10.18.125.36) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 28 Feb 2018 22:50:49 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.116]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.116]) with mapi id 14.03.0319.002; Thu, 1 Mar 2018 14:50:47 +0800 From: "Ye, Ting" To: "Wu, Jiaxin" , "edk2-devel@lists.01.org" CC: "Fu, Siyuan" , "Wu, Jiaxin" Thread-Topic: [edk2] [Patch] NetworkPkg/HttpBootDxe: Correct the parameter check for the usage of HttpBootGetFileFromCache. Thread-Index: AQHTsSau+flo7NtGF0q4yWR0aSLVuKO68N6g Date: Thu, 1 Mar 2018 06:50:47 +0000 Message-ID: References: <20180301062932.14280-1-jiaxin.wu@intel.com> In-Reply-To: <20180301062932.14280-1-jiaxin.wu@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/HttpBootDxe: Correct the parameter check for the usage of HttpBootGetFileFromCache. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Mar 2018 06:44:43 -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: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiax= in Wu Sent: Thursday, March 1, 2018 2:30 PM To: edk2-devel@lists.01.org Cc: Ye, Ting ; Fu, Siyuan ; Wu, Jia= xin Subject: [edk2] [Patch] NetworkPkg/HttpBootDxe: Correct the parameter check= for the usage of HttpBootGetFileFromCache. The patch is to fix the incorrect parameter check for the HttpBootGetFileFr= omCache(). Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- NetworkPkg/HttpBootDxe/HttpBootClient.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c b/NetworkPkg/HttpBootD= xe/HttpBootClient.c index 15e0ab9d69..b93e63bb2f 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootClient.c +++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c @@ -1,9 +1,9 @@ /** @file Implementation of the boot file download function. =20 -Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
This pro= gram and the accompanying materials are licensed and made available under = the terms and conditions of the BSD License that accompanies this distribut= ion. =20 The full text of the license may be found at http://opensource.org/licenses/bsd-license.php. = =20 @@ -434,11 +434,11 @@ HttpBootDhcp6ExtractUriInfo ( goto Error; } } =20 // - // Extract the HTTP server Ip frome URL. This is used to Check route tab= le=20 + // Extract the HTTP server Ip from URL. This is used to Check route=20 + table // whether can send message to HTTP Server Ip through the GateWay. // Status =3D HttpUrlGetIp6 ( Private->BootFileUri, Private->BootFileUriParser, @@ -744,23 +744,22 @@ HttpBootGet= FileFromCache ( LIST_ENTRY *Entry2; HTTP_BOOT_CACHE_CONTENT *Cache; HTTP_BOOT_ENTITY_DATA *EntityData; UINTN CopyedSize; =20 - if (Uri =3D=3D NULL || BufferSize =3D=3D 0 || Buffer =3D=3D NULL || Imag= eType =3D=3D NULL) { + if (Uri =3D=3D NULL || BufferSize =3D=3D NULL || Buffer =3D=3D NULL || I= mageType=20 + =3D=3D NULL) { return EFI_INVALID_PARAMETER; } =20 NET_LIST_FOR_EACH (Entry, &Private->CacheList) { Cache =3D NET_LIST_USER_STRUCT (Entry, HTTP_BOOT_CACHE_CONTENT, Link); // // Compare the URI to see whether we already have a cache for this fil= e. // if ((Cache->RequestData !=3D NULL) && (Cache->RequestData->Url !=3D NULL) && - (StrCmp (Uri, Cache->RequestData->Url) =3D=3D 0))=20 - { + (StrCmp (Uri, Cache->RequestData->Url) =3D=3D 0)) { // // Hit in cache, record image type. // *ImageType =3D Cache->ImageType; =20 @@ -945,11 +944,11 @@ HttpBootGetBootFile ( Url =3D AllocatePool (UrlSize * sizeof (CHAR16)); if (Url =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } AsciiStrToUnicodeStrS (Private->BootFileUri, Url, UrlSize); - if (!HeaderOnly) { + if (!HeaderOnly && Buffer !=3D NULL) { Status =3D HttpBootGetFileFromCache (Private, Url, BufferSize, Buffer,= ImageType); if (Status !=3D EFI_NOT_FOUND) { FreePool (Url); return Status; } @@ -1127,11 +1126,11 @@ HttpBootGetBootFile ( Context.Buffer =3D Buffer; Context.BufferSize =3D *BufferSize; Context.Cache =3D Cache; Context.Private =3D Private; Status =3D HttpInitMsgParser ( - HeaderOnly? HttpMethodHead : HttpMethodGet, + HeaderOnly ? HttpMethodHead : HttpMethodGet, ResponseData->Response.StatusCode, ResponseData->HeaderCount, ResponseData->Headers, HttpBootGetBootFileCallback, (VOID*) &Context, -- 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel