diff options
author | hhuan13 <hhuan13@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-07-07 05:55:41 +0000 |
---|---|---|
committer | hhuan13 <hhuan13@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-07-07 05:55:41 +0000 |
commit | 4546bcbb3ab9e94a7dd2c225e3d1a4e0ab032e70 (patch) | |
tree | f2645288299874ad59ee31365f2b5ca8c88216d0 | |
parent | be757a7fb5c83ba98ef2458c9136459d44ae5e03 (diff) | |
download | edk2-platforms-4546bcbb3ab9e94a7dd2c225e3d1a4e0ab032e70.tar.xz |
Fix a bug:
RFC 2132, Section 9.5 does not strictly state Bootfile name (option 67) is null
terminated string. So force to append null terminated character at the end of string.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10635 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c index 2dc7471fe2..efb7aac757 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c @@ -135,6 +135,7 @@ PxeBcParseCachedDhcpPacket ( EFI_DHCP4_PACKET_OPTION *Option;
UINT8 OfferType;
UINTN Index;
+ UINT8 *Ptr8;
CachedPacket->IsPxeOffer = FALSE;
ZeroMem (CachedPacket->Dhcp4Option, sizeof (CachedPacket->Dhcp4Option));
@@ -188,6 +189,14 @@ PxeBcParseCachedDhcpPacket ( sizeof (Offer->Dhcp4.Header.BootFileName),
PXEBC_DHCP4_TAG_BOOTFILE
);
+ //
+ // RFC 2132, Section 9.5 does not strictly state Bootfile name (option 67) is null
+ // terminated string. So force to append null terminated character at the end of string.
+ //
+ ASSERT (Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] != NULL);
+ Ptr8 = (UINT8*)&Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE]->Data[0];
+ Ptr8 += Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE]->Length;
+ Ptr8 = '\0';
} else if ((Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] == NULL) &&
(Offer->Dhcp4.Header.BootFileName[0] != 0)) {
|