BootFileName or ServerName in DHCP offer may be overloaded and cannot
be used, so we manually set the strings to be null to avoid misusing.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: chenzhihui <[email protected]>
Signed-off-by: Heyi Guo <[email protected]>
Cc: Feng Tian <[email protected]>
Cc: Star Zeng <[email protected]>
Cc: Siyuan Fu <[email protected]>
Cc: Jiaxin Wu <[email protected]>
---
 MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c 
b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
index 6c06373..ecd1903 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
@@ -172,6 +172,8 @@ PxeBcParseCachedDhcpPacket (
                              );
         }
       }
+      // Terminate the invalid string to avoid misusing
+      Offer->Dhcp4.Header.BootFileName[0] = 0;
     }
     if ((Option->Data[0] & PXEBC_DHCP4_OVERLOAD_SERVER_NAME) != 0) {
       for (Index = 0; Index < PXEBC_DHCP4_TAG_INDEX_MAX; Index++) {
@@ -183,6 +185,8 @@ PxeBcParseCachedDhcpPacket (
                              );
         }
       }
+      // Terminate the invalid string to avoid misusing
+      Offer->Dhcp4.Header.ServerName[0] = 0;
     }
   }
 
-- 
2.7.0

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to