can be found in the Tiano Firmware Volume Generation Utility \r
Specification, review draft.\r
\r
-Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
Error (NULL, 0, 1003, "Invalid option value", "Input Ffsfile can't be null");\r
return STATUS_ERROR;\r
}\r
- strcpy (mFvDataInfo.FvFiles[Index], argv[1]);\r
+ if (strlen (argv[1]) > MAX_LONG_FILE_PATH - 1) {\r
+ Error (NULL, 0, 1003, "Invalid option value", "Input Ffsfile name %s is too long!", argv[1]);\r
+ return STATUS_ERROR;\r
+ }\r
+ strncpy (mFvDataInfo.FvFiles[Index], argv[1], MAX_LONG_FILE_PATH - 1);\r
+ mFvDataInfo.FvFiles[Index][MAX_LONG_FILE_PATH - 1] = 0;\r
DebugMsg (NULL, 0, 9, "FV component file", "the %uth name is %s", (unsigned) Index + 1, argv[1]);\r
argc -= 2;\r
argv += 2;\r
}\r
}\r
\r
- for (Index = 0; Index < MAX_NUMBER_OF_FILES_IN_FV; Index++) {\r
+ for (Index = 0; Number + Index < MAX_NUMBER_OF_FILES_IN_FV; Index++) {\r
//\r
// Read the FFS file list\r
//\r
UINT8 *FvImage;\r
UINTN FvImageSize;\r
FILE *FvFile;\r
- CHAR8 FvMapName [MAX_LONG_FILE_PATH];\r
+ CHAR8 *FvMapName;\r
FILE *FvMapFile;\r
EFI_FIRMWARE_VOLUME_EXT_HEADER *FvExtHeader;\r
FILE *FvExtHeaderFile;\r
UINTN FileSize;\r
- CHAR8 FvReportName[MAX_LONG_FILE_PATH];\r
+ CHAR8 *FvReportName;\r
FILE *FvReportFile;\r
\r
FvBufferHeader = NULL;\r
FvFile = NULL;\r
+ FvMapName = NULL;\r
FvMapFile = NULL;\r
+ FvReportName = NULL;\r
FvReportFile = NULL;\r
\r
if (InfFileImage != NULL) {\r
// FvMap file to log the function address of all modules in one Fvimage\r
//\r
if (MapFileName != NULL) {\r
+ if (strlen (MapFileName) > MAX_LONG_FILE_PATH - 1) {\r
+ Error (NULL, 0, 1003, "Invalid option value", "MapFileName %s is too long!", MapFileName);\r
+ Status = EFI_ABORTED;\r
+ goto Finish;\r
+ }\r
+\r
+ FvMapName = malloc (strlen (MapFileName) + 1);\r
+ if (FvMapName == NULL) {\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto Finish;\r
+ }\r
+\r
strcpy (FvMapName, MapFileName);\r
} else {\r
+ if (strlen (FvFileName) + strlen (".map") > MAX_LONG_FILE_PATH - 1) {\r
+ Error (NULL, 0, 1003, "Invalid option value", "FvFileName %s is too long!", FvFileName);\r
+ Status = EFI_ABORTED;\r
+ goto Finish;\r
+ }\r
+\r
+ FvMapName = malloc (strlen (FvFileName) + strlen (".map") + 1);\r
+ if (FvMapName == NULL) {\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto Finish;\r
+ }\r
+\r
strcpy (FvMapName, FvFileName);\r
strcat (FvMapName, ".map");\r
}\r
//\r
// FvReport file to log the FV information in one Fvimage\r
//\r
+ if (strlen (FvFileName) + strlen (".txt") > MAX_LONG_FILE_PATH - 1) {\r
+ Error (NULL, 0, 1003, "Invalid option value", "FvFileName %s is too long!", FvFileName);\r
+ Status = EFI_ABORTED;\r
+ goto Finish;\r
+ }\r
+\r
+ FvReportName = malloc (strlen (FvFileName) + strlen (".txt") + 1);\r
+ if (FvReportName == NULL) {\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto Finish;\r
+ }\r
+\r
strcpy (FvReportName, FvFileName);\r
strcat (FvReportName, ".txt");\r
\r
if (FvExtHeader != NULL) {\r
free (FvExtHeader);\r
}\r
+\r
+ if (FvMapName != NULL) {\r
+ free (FvMapName);\r
+ }\r
+\r
+ if (FvReportName != NULL) {\r
+ free (FvReportName);\r
+ }\r
\r
if (FvFile != NULL) {\r
fflush (FvFile);\r