From aa437778fcbcce7ec86414b0f72ad9aa4df03d53 Mon Sep 17 00:00:00 2001 From: Fu Siyuan Date: Tue, 3 May 2016 13:29:52 +0800 Subject: [PATCH] NetworkPkg: Ignore BootFileName if it is overloaded. 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 Reviewed-by: Wu Jiaxin Reviewed-by: Ye Ting --- NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c index 587566d4e0..818586f955 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c @@ -1,7 +1,7 @@ /** @file Functions implementation related with DHCPv4 for UefiPxeBc Driver. - Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 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 @@ -460,9 +460,11 @@ PxeBcParseDhcp4Packet ( BOOLEAN IsProxyOffer; BOOLEAN IsPxeOffer; UINT8 *Ptr8; + BOOLEAN FileFieldOverloaded; IsProxyOffer = FALSE; IsPxeOffer = FALSE; + FileFieldOverloaded = FALSE; ZeroMem (Cache4->OptList, sizeof (Cache4->OptList)); ZeroMem (&Cache4->VendorOpt, sizeof (Cache4->VendorOpt)); @@ -488,6 +490,7 @@ PxeBcParseDhcp4Packet ( Option = Options[PXEBC_DHCP4_TAG_INDEX_OVERLOAD]; if (Option != NULL) { if ((Option->Data[0] & PXEBC_DHCP4_OVERLOAD_FILE) != 0) { + FileFieldOverloaded = TRUE; for (Index = 0; Index < PXEBC_DHCP4_TAG_INDEX_MAX; Index++) { if (Options[Index] == NULL) { Options[Index] = PxeBcParseDhcp4Options ( @@ -550,7 +553,7 @@ PxeBcParseDhcp4Packet ( if (*(Ptr8 - 1) != '\0') { *Ptr8 = '\0'; } - } else if (Offer->Dhcp4.Header.BootFileName[0] != 0) { + } else if (!FileFieldOverloaded && Offer->Dhcp4.Header.BootFileName[0] != 0) { // // If the bootfile is not present and bootfilename is present in DHCPv4 packet, just parse it. // Do not count dhcp option header here, or else will destroy the serverhostname. -- 2.39.2