From 61e0f079bcf1b4e6ae9a00c7ae0ae0bd91a2d822 Mon Sep 17 00:00:00 2001 From: Heyi Guo Date: Sat, 23 Apr 2016 15:01:16 +0800 Subject: [PATCH] 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 Signed-off-by: Heyi Guo Reviewed-by: Fu Siyuan --- .../Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c | 10 +++++++--- 1 file 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.
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
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])); - + } } // -- 2.39.2