EFI_DHCP4_PACKET_OPTION *Option;\r
UINT8 OfferType;\r
UINTN Index;\r
+ UINT8 *Ptr8;\r
\r
CachedPacket->IsPxeOffer = FALSE;\r
ZeroMem (CachedPacket->Dhcp4Option, sizeof (CachedPacket->Dhcp4Option));\r
sizeof (Offer->Dhcp4.Header.BootFileName),\r
PXEBC_DHCP4_TAG_BOOTFILE\r
);\r
+ //\r
+ // RFC 2132, Section 9.5 does not strictly state Bootfile name (option 67) is null \r
+ // terminated string. So force to append null terminated character at the end of string.\r
+ //\r
+ if (Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] != NULL) {\r
+ Ptr8 = (UINT8*)&Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE]->Data[0];\r
+ Ptr8 += Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE]->Length;\r
+ *Ptr8 = '\0';\r
+ }\r
\r
} else if ((Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] == NULL) &&\r
(Offer->Dhcp4.Header.BootFileName[0] != 0)) {\r
ZeroMem (DhcpHeader->ClientHwAddr, sizeof (EFI_GUID));\r
}\r
\r
- DhcpHeader->HwAddrLen = sizeof (EFI_GUID);\r
+ DhcpHeader->HwAddrLen = (UINT8) sizeof (EFI_GUID);\r
}\r
\r
if (Dhcp4Event == Dhcp4SendDiscover) {\r
// Append max message size.\r
//\r
OptList[Index]->OpCode = PXEBC_DHCP4_TAG_MAXMSG;\r
- OptList[Index]->Length = sizeof (PXEBC_DHCP4_OPTION_MAX_MESG_SIZE);\r
+ OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_MAX_MESG_SIZE);\r
OptEnt.MaxMesgSize = (PXEBC_DHCP4_OPTION_MAX_MESG_SIZE *) OptList[Index]->Data;\r
Value = NTOHS (PXEBC_DHCP4_MAX_PACKET_SIZE);\r
CopyMem (&OptEnt.MaxMesgSize->Size, &Value, sizeof (UINT16));\r
// Append UUID/Guid-based client identifier option\r
//\r
OptList[Index]->OpCode = PXEBC_PXE_DHCP4_TAG_UUID;\r
- OptList[Index]->Length = sizeof (PXEBC_DHCP4_OPTION_UUID);\r
+ OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_UUID);\r
OptEnt.Uuid = (PXEBC_DHCP4_OPTION_UUID *) OptList[Index]->Data;\r
OptEnt.Uuid->Type = 0;\r
Index++;\r
// Append client network device interface option\r
//\r
OptList[Index]->OpCode = PXEBC_PXE_DHCP4_TAG_UNDI;\r
- OptList[Index]->Length = sizeof (PXEBC_DHCP4_OPTION_UNDI);\r
+ OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_UNDI);\r
OptEnt.Undi = (PXEBC_DHCP4_OPTION_UNDI *) OptList[Index]->Data;\r
if (Private->Nii != NULL) {\r
OptEnt.Undi->Type = Private->Nii->Type;\r
// Append client system architecture option\r
//\r
OptList[Index]->OpCode = PXEBC_PXE_DHCP4_TAG_ARCH;\r
- OptList[Index]->Length = sizeof (PXEBC_DHCP4_OPTION_ARCH);\r
+ OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_ARCH);\r
OptEnt.Arch = (PXEBC_DHCP4_OPTION_ARCH *) OptList[Index]->Data;\r
Value = HTONS (EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE);\r
CopyMem (&OptEnt.Arch->Type, &Value, sizeof (UINT16));\r
// Append client system architecture option\r
//\r
OptList[Index]->OpCode = PXEBC_DHCP4_TAG_CLASS_ID;\r
- OptList[Index]->Length = sizeof (PXEBC_DHCP4_OPTION_CLID);\r
+ OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_CLID);\r
OptEnt.Clid = (PXEBC_DHCP4_OPTION_CLID *) OptList[Index]->Data;\r
CopyMem (OptEnt.Clid, DEFAULT_CLASS_ID_DATA, sizeof (PXEBC_DHCP4_OPTION_CLID));\r
CvtNum (EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE, OptEnt.Clid->ArchitectureType, sizeof (OptEnt.Clid->ArchitectureType));\r
//\r
// Add vendor option of PXE_BOOT_ITEM\r
//\r
- VendorOptLen = (sizeof (EFI_DHCP4_PACKET_OPTION) - 1) * 2 + sizeof (PXEBC_OPTION_BOOT_ITEM) + 1;\r
+ VendorOptLen = (UINT8) ((sizeof (EFI_DHCP4_PACKET_OPTION) - 1) * 2 + sizeof (PXEBC_OPTION_BOOT_ITEM) + 1);\r
OptList[OptCount] = AllocatePool (VendorOptLen);\r
if (OptList[OptCount] == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
OptList[OptCount]->Length = (UINT8) (VendorOptLen - 2);\r
PxeOpt = (EFI_DHCP4_PACKET_OPTION *) OptList[OptCount]->Data;\r
PxeOpt->OpCode = PXEBC_VENDOR_TAG_BOOT_ITEM;\r
- PxeOpt->Length = sizeof (PXEBC_OPTION_BOOT_ITEM);\r
+ PxeOpt->Length = (UINT8) sizeof (PXEBC_OPTION_BOOT_ITEM);\r
PxeBootItem = (PXEBC_OPTION_BOOT_ITEM *) PxeOpt->Data;\r
PxeBootItem->Type = HTONS (Type);\r
PxeBootItem->Layer = HTONS (*Layer);\r
ZeroMem (DhcpHeader->ClientHwAddr, sizeof (EFI_GUID));\r
}\r
\r
- DhcpHeader->HwAddrLen = sizeof (EFI_GUID);\r
+ DhcpHeader->HwAddrLen = (UINT8) sizeof (EFI_GUID);\r
}\r
\r
Xid = NET_RANDOM (NetRandomInitSeed ());\r