summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeyi Guo <heyi.guo@linaro.org>2016-04-23 15:01:16 +0800
committerFu Siyuan <siyuan.fu@intel.com>2016-05-06 11:41:40 +0800
commit61e0f079bcf1b4e6ae9a00c7ae0ae0bd91a2d822 (patch)
treead3a343c822ce112ab3d7f0af5cc2a30cfd87c43
parenta1522257a9d56049fb9ad0f00280948f4c09042f (diff)
downloadedk2-platforms-61e0f079bcf1b4e6ae9a00c7ae0ae0bd91a2d822.tar.xz
MdeModulePkg: Ignore BootFileName if it is overloaded.
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>
-rw-r--r--MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
index 6c06373004..38f630301b 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
@@ -2,7 +2,7 @@
Support for PxeBc dhcp functions.
Copyright (c) 2013, Red Hat, Inc.
-Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -228,9 +228,13 @@ PxeBcParseCachedDhcpPacket (
// If the bootfile is not present and bootfilename is present in dhcp packet, just parse it.
// And do not count dhcp option header, or else will destroy the serverhostname.
//
- Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] = (EFI_DHCP4_PACKET_OPTION *) (&Offer->Dhcp4.Header.BootFileName[0] -
+ // Make sure "BootFileName" is not overloaded.
+ //
+ if (Options[PXEBC_DHCP4_TAG_INDEX_OVERLOAD] == NULL ||
+ (Options[PXEBC_DHCP4_TAG_INDEX_OVERLOAD]->Data[0] & PXEBC_DHCP4_OVERLOAD_FILE) == 0) {
+ Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] = (EFI_DHCP4_PACKET_OPTION *) (&Offer->Dhcp4.Header.BootFileName[0] -
OFFSET_OF (EFI_DHCP4_PACKET_OPTION, Data[0]));
-
+ }
}
//