]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Ignore BootFileName if it is overloaded.
authorHeyi Guo <heyi.guo@linaro.org>
Sat, 23 Apr 2016 07:01:16 +0000 (15:01 +0800)
committerFu Siyuan <siyuan.fu@intel.com>
Fri, 6 May 2016 03:41:40 +0000 (11:41 +0800)
Make sure "BootFileName" is not overloaded before use it in PXE driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: chenzhihui <chenzhihui4@huawei.com>
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c

index 6c0637300447979ff5689dbbec1593e64b7d9de8..38f630301b1b6e7f0f2950636f8d683edbb2a7c0 100644 (file)
@@ -2,7 +2,7 @@
   Support for PxeBc dhcp functions.\r
 \r
 Copyright (c) 2013, Red Hat, Inc.\r
-Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -228,9 +228,13 @@ PxeBcParseCachedDhcpPacket (
     // If the bootfile is not present and bootfilename is present in dhcp packet, just parse it.\r
     // And do not count dhcp option header, or else will destroy the serverhostname.\r
     //\r
-    Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] = (EFI_DHCP4_PACKET_OPTION *) (&Offer->Dhcp4.Header.BootFileName[0] -\r
+    // Make sure "BootFileName" is not overloaded.\r
+    //\r
+    if (Options[PXEBC_DHCP4_TAG_INDEX_OVERLOAD] == NULL ||\r
+        (Options[PXEBC_DHCP4_TAG_INDEX_OVERLOAD]->Data[0] & PXEBC_DHCP4_OVERLOAD_FILE) == 0) {\r
+      Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] = (EFI_DHCP4_PACKET_OPTION *) (&Offer->Dhcp4.Header.BootFileName[0] -\r
                                             OFFSET_OF (EFI_DHCP4_PACKET_OPTION, Data[0]));\r
-\r
+    }\r
   }\r
 \r
   //\r