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 <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
This commit is contained in:
Jiaxin Wu 2018-03-01 11:52:28 +08:00
parent 5ac0a5450b
commit 951c6e63f8
1 changed files with 6 additions and 7 deletions

View File

@ -1,7 +1,7 @@
/** @file
Implementation of the boot file download function.
Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
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,