]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpBootDxe/HttpBootClient.c
NetworkPkg/HttpBootDxe: Correct the parameter check for the usage of HttpBootGetFileF...
[mirror_edk2.git] / NetworkPkg / HttpBootDxe / HttpBootClient.c
index 15e0ab9d698eefdccda425aaa046d8df81d6abc0..b93e63bb2f0097ea5d518dd41b30f3435b553466 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation of the boot file download function.\r
 \r
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
@@ -436,7 +436,7 @@ HttpBootDhcp6ExtractUriInfo (
   }\r
   \r
   //\r
-  // Extract the HTTP server Ip frome URL. This is used to Check route table \r
+  // Extract the HTTP server Ip from URL. This is used to Check route table \r
   // whether can send message to HTTP Server Ip through the GateWay.\r
   //\r
   Status = HttpUrlGetIp6 (\r
@@ -746,7 +746,7 @@ HttpBootGetFileFromCache (
   HTTP_BOOT_ENTITY_DATA       *EntityData;\r
   UINTN                       CopyedSize;\r
   \r
-  if (Uri == NULL || BufferSize == 0 || Buffer == NULL || ImageType == NULL) {\r
+  if (Uri == NULL || BufferSize == NULL || Buffer == NULL || ImageType == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -757,8 +757,7 @@ HttpBootGetFileFromCache (
     //\r
     if ((Cache->RequestData != NULL) &&\r
         (Cache->RequestData->Url != NULL) &&\r
-        (StrCmp (Uri, Cache->RequestData->Url) == 0)) \r
-    {\r
+        (StrCmp (Uri, Cache->RequestData->Url) == 0)) {\r
       //\r
       // Hit in cache, record image type.\r
       //\r
@@ -947,7 +946,7 @@ HttpBootGetBootFile (
     return EFI_OUT_OF_RESOURCES;\r
   }\r
   AsciiStrToUnicodeStrS (Private->BootFileUri, Url, UrlSize);\r
-  if (!HeaderOnly) {\r
+  if (!HeaderOnly && Buffer != NULL) {\r
     Status = HttpBootGetFileFromCache (Private, Url, BufferSize, Buffer, ImageType);\r
     if (Status != EFI_NOT_FOUND) {\r
       FreePool (Url);\r
@@ -1129,7 +1128,7 @@ HttpBootGetBootFile (
   Context.Cache      = Cache;\r
   Context.Private    = Private;\r
   Status = HttpInitMsgParser (\r
-             HeaderOnly? HttpMethodHead : HttpMethodGet,\r
+             HeaderOnly ? HttpMethodHead : HttpMethodGet,\r
              ResponseData->Response.StatusCode,\r
              ResponseData->HeaderCount,\r
              ResponseData->Headers,\r