]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/EfiRom/EfiRom.c
BaseTools: Fix a bug for Size incorrect of Void* Fixatbuild Pcd
[mirror_edk2.git] / BaseTools / Source / C / EfiRom / EfiRom.c
index 6648f4c738f69e5914ee2c4ec7203453f032787e..fc3b5ad277a60db17bd7b3fda5a8a2bbf39932ee 100644 (file)
@@ -96,7 +96,13 @@ Returns:
   //\r
   if (!mOptions.OutFileName[0]) {\r
     if (mOptions.FileList != NULL) {\r
-      strcpy (mOptions.OutFileName, mOptions.FileList->FileName);\r
+      if (strlen (mOptions.FileList->FileName) >= MAX_PATH) {\r
+        Status = STATUS_ERROR;\r
+        Error (NULL, 0, 2000, "Invalid parameter", "Input file name is too long - %s.", mOptions.FileList->FileName);\r
+        goto BailOut;\r
+      }\r
+      strncpy (mOptions.OutFileName, mOptions.FileList->FileName, MAX_PATH - 1);\r
+      mOptions.OutFileName[MAX_PATH - 1] = 0;\r
       //\r
       // Find the last . on the line and replace the filename extension with\r
       // the default\r