From 951c6e63f8dbcf9eb4c720cf218cb7ede7a7255e Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Thu, 1 Mar 2018 11:52:28 +0800 Subject: [PATCH] NetworkPkg/HttpBootDxe: Correct the parameter check for the usage of HttpBootGetFileFromCache. The patch is to fix the incorrect parameter check for the HttpBootGetFileFromCache(). 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 --- NetworkPkg/HttpBootDxe/HttpBootClient.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c b/NetworkPkg/HttpBootDxe/HttpBootClient.c index 15e0ab9d69..b93e63bb2f 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootClient.c +++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c @@ -1,7 +1,7 @@ /** @file Implementation of the boot file download function. -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 available under the terms and conditions of the BSD License that accompanies this distribution. @@ -436,7 +436,7 @@ HttpBootDhcp6ExtractUriInfo ( } // - // Extract the HTTP server Ip frome URL. This is used to Check route table + // Extract the HTTP server Ip from URL. This is used to Check route table // whether can send message to HTTP Server Ip through the GateWay. // Status = HttpUrlGetIp6 ( @@ -746,7 +746,7 @@ HttpBootGetFileFromCache ( HTTP_BOOT_ENTITY_DATA *EntityData; UINTN CopyedSize; - if (Uri == NULL || BufferSize == 0 || Buffer == NULL || ImageType == NULL) { + if (Uri == NULL || BufferSize == NULL || Buffer == NULL || ImageType == NULL) { return EFI_INVALID_PARAMETER; } @@ -757,8 +757,7 @@ HttpBootGetFileFromCache ( // if ((Cache->RequestData != NULL) && (Cache->RequestData->Url != NULL) && - (StrCmp (Uri, Cache->RequestData->Url) == 0)) - { + (StrCmp (Uri, Cache->RequestData->Url) == 0)) { // // Hit in cache, record image type. // @@ -947,7 +946,7 @@ HttpBootGetBootFile ( return EFI_OUT_OF_RESOURCES; } AsciiStrToUnicodeStrS (Private->BootFileUri, Url, UrlSize); - if (!HeaderOnly) { + if (!HeaderOnly && Buffer != NULL) { Status = HttpBootGetFileFromCache (Private, Url, BufferSize, Buffer, ImageType); if (Status != EFI_NOT_FOUND) { FreePool (Url); @@ -1129,7 +1128,7 @@ HttpBootGetBootFile ( Context.Cache = Cache; Context.Private = Private; Status = HttpInitMsgParser ( - HeaderOnly? HttpMethodHead : HttpMethodGet, + HeaderOnly ? HttpMethodHead : HttpMethodGet, ResponseData->Response.StatusCode, ResponseData->HeaderCount, ResponseData->Headers, -- 2.39.2