]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
IntelSiliconPkg/VtdInfoSample: Fix IGD RMRR memory.
[mirror_edk2.git] / ShellPkg / Library / UefiShellTftpCommandLib / Tftp.c
old mode 100644 (file)
new mode 100755 (executable)
index 6561270..5c50797
@@ -272,6 +272,7 @@ ShellCommandRunTftp (
   CONST CHAR16            *ValueStr;\r
   CONST CHAR16            *RemoteFilePath;\r
   CHAR8                   *AsciiRemoteFilePath;\r
+  UINTN                   FilePathSize;\r
   CONST CHAR16            *Walker;\r
   CONST CHAR16            *LocalFilePath;\r
   EFI_MTFTP4_CONFIG_DATA  Mtftp4ConfigData;\r
@@ -341,7 +342,7 @@ ShellCommandRunTftp (
     goto Error;\r
   }\r
 \r
-  Mtftp4ConfigData = DefaultMtftp4ConfigData;\r
+  CopyMem (&Mtftp4ConfigData, &DefaultMtftp4ConfigData, sizeof (EFI_MTFTP4_CONFIG_DATA));\r
 \r
   //\r
   // Check the host IPv4 address\r
@@ -358,14 +359,13 @@ ShellCommandRunTftp (
 \r
   RemoteFilePath = ShellCommandLineGetRawValue (CheckPackage, 2);\r
   ASSERT(RemoteFilePath != NULL);\r
-  AsciiRemoteFilePath = AllocatePool (\r
-                          (StrLen (RemoteFilePath) + 1) * sizeof (CHAR8)\r
-                          );\r
+  FilePathSize = StrLen (RemoteFilePath) + 1;\r
+  AsciiRemoteFilePath = AllocatePool (FilePathSize);\r
   if (AsciiRemoteFilePath == NULL) {\r
     ShellStatus = SHELL_OUT_OF_RESOURCES;\r
     goto Error;\r
   }\r
-  UnicodeStrToAsciiStr (RemoteFilePath, AsciiRemoteFilePath);\r
+  UnicodeStrToAsciiStrS (RemoteFilePath, AsciiRemoteFilePath, FilePathSize);\r
 \r
   if (ParamCount == 4) {\r
     LocalFilePath = ShellCommandLineGetRawValue (CheckPackage, 3);\r