]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.c
Refine code to make code run safely.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Dhcp4Dxe / Dhcp4Option.c
index ff48bec7a4b7f7ccc72ae4a530ee1e9c51dc45d6..d7700bccc4871c0a312eaa6cd398fa0d9a0ef350 100644 (file)
@@ -611,7 +611,7 @@ DhcpParseOption (
   // Allocate a buffer to hold the DHCP options, and after that, a\r
   // continuous buffer to put all the options' data.\r
   //\r
-  Options = AllocateZeroPool (OptNum * sizeof (DHCP_OPTION) + TotalLen);\r
+  Options = AllocateZeroPool ((UINTN) (OptNum * sizeof (DHCP_OPTION)) + TotalLen);\r
 \r
   if (Options == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
@@ -754,7 +754,7 @@ DhcpAppendOption (
 \r
     *(Buf++) = Tag;\r
     *(Buf++) = (UINT8) Len;\r
-    CopyMem (Buf, Data + Index * 255, Len);\r
+    CopyMem (Buf, Data + Index * 255, (UINTN) Len);\r
 \r
     Buf     += Len;\r
   }\r