]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg: Ignore BootFileName if it is overloaded.
authorFu Siyuan <siyuan.fu@intel.com>
Tue, 3 May 2016 05:29:52 +0000 (13:29 +0800)
committerFu Siyuan <siyuan.fu@intel.com>
Fri, 6 May 2016 03:42:24 +0000 (11:42 +0800)
Make sure "File" field is not overloaded to carry other DHCP options before use
it in PXE driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c

index 587566d4e0d8a5cba7fb6a1269a6a84de223b979..818586f9552ff3bbdcbbbbb3bbef0a6901049f7b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Functions implementation related with DHCPv4 for UefiPxeBc Driver.\r
 \r
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -460,9 +460,11 @@ PxeBcParseDhcp4Packet (
   BOOLEAN                        IsProxyOffer;\r
   BOOLEAN                        IsPxeOffer;\r
   UINT8                          *Ptr8;\r
+  BOOLEAN                        FileFieldOverloaded;\r
 \r
   IsProxyOffer = FALSE;\r
   IsPxeOffer   = FALSE;\r
+  FileFieldOverloaded = FALSE;\r
 \r
   ZeroMem (Cache4->OptList, sizeof (Cache4->OptList));\r
   ZeroMem (&Cache4->VendorOpt, sizeof (Cache4->VendorOpt));\r
@@ -488,6 +490,7 @@ PxeBcParseDhcp4Packet (
   Option = Options[PXEBC_DHCP4_TAG_INDEX_OVERLOAD];\r
   if (Option != NULL) {\r
     if ((Option->Data[0] & PXEBC_DHCP4_OVERLOAD_FILE) != 0) {\r
+      FileFieldOverloaded = TRUE;\r
       for (Index = 0; Index < PXEBC_DHCP4_TAG_INDEX_MAX; Index++) {\r
         if (Options[Index] == NULL) {\r
           Options[Index] = PxeBcParseDhcp4Options (\r
@@ -550,7 +553,7 @@ PxeBcParseDhcp4Packet (
     if (*(Ptr8 - 1) != '\0') {\r
       *Ptr8 = '\0';\r
     }\r
-  } else if (Offer->Dhcp4.Header.BootFileName[0] != 0) {\r
+  } else if (!FileFieldOverloaded && Offer->Dhcp4.Header.BootFileName[0] != 0) {\r
     //\r
     // If the bootfile is not present and bootfilename is present in DHCPv4 packet, just parse it.\r
     // Do not count dhcp option header here, or else will destroy the serverhostname.\r