From nobody Mon Dec 23 05:09:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1519885778743515.1474841204611; Wed, 28 Feb 2018 22:29:38 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A208522423849; Wed, 28 Feb 2018 22:23:29 -0800 (PST) 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 2030E2242383D for ; Wed, 28 Feb 2018 22:23:27 -0800 (PST) Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Feb 2018 22:29:35 -0800 Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.134]) by orsmga008.jf.intel.com with ESMTP; 28 Feb 2018 22:29:34 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,407,1515484800"; d="scan'208";a="21686496" From: Jiaxin Wu To: edk2-devel@lists.01.org Date: Thu, 1 Mar 2018 14:29:31 +0800 Message-Id: <20180301062932.14280-1-jiaxin.wu@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 Subject: [edk2] [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: , Cc: Ye Ting , Fu Siyuan , Wu Jiaxin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Fu Siyuan Reviewed-by: Ye Ting =20 --- 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 program and the accompanying materials are licensed and made availabl= e under=20 the terms and conditions of the BSD License that accompanies this distribu= tion. =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 tabl= e=20 // whether can send message to HTTP Server Ip through the GateWay. // Status =3D HttpUrlGetIp6 ( Private->BootFileUri, Private->BootFileUriParser, @@ -744,23 +744,22 @@ HttpBootGetFileFromCache ( 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 =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, --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel