BaseTools/Source/C/VfrCompile/EfiVfr.h | 3 +-- BaseTools/Source/C/VfrCompile/VfrCompiler.cpp | 24 ------------------------ 2 files changed, 1 insertion(+), 26 deletions(-)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=579
Since we have already used LongFilePath() to convert
file path, so we can remove the MAX_PATH limitation.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Daniel D�az <daniel.diaz@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
BaseTools/Source/C/VfrCompile/EfiVfr.h | 3 +--
BaseTools/Source/C/VfrCompile/VfrCompiler.cpp | 24 ------------------------
2 files changed, 1 insertion(+), 26 deletions(-)
diff --git a/BaseTools/Source/C/VfrCompile/EfiVfr.h b/BaseTools/Source/C/VfrCompile/EfiVfr.h
index d187902..10d1257 100644
--- a/BaseTools/Source/C/VfrCompile/EfiVfr.h
+++ b/BaseTools/Source/C/VfrCompile/EfiVfr.h
@@ -1,9 +1,9 @@
/** @file
Defines and prototypes for the UEFI VFR compiler internal use.
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
@@ -17,11 +17,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Common/UefiBaseTypes.h"
#include "Common/UefiInternalFormRepresentation.h"
#include "Common/MdeModuleHii.h"
-#define MAX_PATH 255
#define MAX_VFR_LINE_LEN 4096
#define EFI_IFR_MAX_LENGTH 0xFF
#define MAX_IFR_EXPRESSION_DEPTH 0x9
diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
index e65a925..831f6b5 100644
--- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
@@ -117,14 +117,10 @@ CVfrCompiler::OptionInitialization (
Index++;
if ((Index >= Argc) || (Argv[Index][0] == '-')) {
DebugError (NULL, 0, 1001, "Missing option", "-o missing output directory name");
goto Fail;
}
- if (strlen (Argv[Index]) > MAX_PATH - 1) {
- DebugError (NULL, 0, 1003, "Invalid option value", "Output directory name %s is too long", Argv[Index]);
- goto Fail;
- }
mOptions.OutputDirectory = (CHAR8 *) malloc (strlen (Argv[Index]) + strlen ("\\") + 1);
if (mOptions.OutputDirectory == NULL) {
DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
goto Fail;
@@ -184,14 +180,10 @@ CVfrCompiler::OptionInitialization (
if (Index != Argc - 1) {
DebugError (NULL, 0, 1001, "Missing option", "VFR file name is not specified.");
goto Fail;
} else {
- if (strlen (Argv[Index]) > MAX_PATH) {
- DebugError (NULL, 0, 1003, "Invalid option value", "VFR file name %s is too long.", Argv[Index]);
- goto Fail;
- }
mOptions.VfrFileName = (CHAR8 *) malloc (strlen (Argv[Index]) + 1);
if (mOptions.VfrFileName == NULL) {
DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
goto Fail;
}
@@ -353,14 +345,10 @@ CVfrCompiler::SetBaseFileName (
if ((pExt = strchr (pFileName, '.')) == NULL) {
return -1;
}
*pExt = '\0';
- if (strlen (pFileName) > MAX_PATH - 1) {
- *pExt = '.';
- return -1;
- }
mOptions.VfrBaseFileName = (CHAR8 *) malloc (strlen (pFileName) + 1);
if (mOptions.VfrBaseFileName == NULL) {
*pExt = '.';
return -1;
@@ -385,13 +373,10 @@ CVfrCompiler::SetPkgOutputFileName (
Length = strlen (mOptions.OutputDirectory) +
strlen (mOptions.VfrBaseFileName) +
strlen (VFR_PACKAGE_FILENAME_EXTENSION) +
1;
- if (Length > MAX_PATH) {
- return -1;
- }
mOptions.PkgOutputFileName = (CHAR8 *) malloc (Length);
if (mOptions.PkgOutputFileName == NULL) {
return -1;
}
@@ -416,13 +401,10 @@ CVfrCompiler::SetCOutputFileName (
Length = strlen (mOptions.OutputDirectory) +
strlen (mOptions.VfrBaseFileName) +
strlen (".c") +
1;
- if (Length > MAX_PATH) {
- return -1;
- }
mOptions.COutputFileName = (CHAR8 *) malloc (Length);
if (mOptions.COutputFileName == NULL) {
return -1;
}
@@ -447,13 +429,10 @@ CVfrCompiler::SetPreprocessorOutputFileName (
Length = strlen (mOptions.OutputDirectory) +
strlen (mOptions.VfrBaseFileName) +
strlen (VFR_PREPROCESS_FILENAME_EXTENSION) +
1;
- if (Length > MAX_PATH) {
- return -1;
- }
mOptions.PreprocessorOutputFileName = (CHAR8 *) malloc (Length);
if (mOptions.PreprocessorOutputFileName == NULL) {
return -1;
}
@@ -478,13 +457,10 @@ CVfrCompiler::SetRecordListFileName (
Length = strlen (mOptions.OutputDirectory) +
strlen (mOptions.VfrBaseFileName) +
strlen (VFR_RECORDLIST_FILENAME_EXTENSION) +
1;
- if (Length > MAX_PATH) {
- return -1;
- }
mOptions.RecordListFile = (CHAR8 *) malloc (Length);
if (mOptions.RecordListFile == NULL) {
return -1;
}
--
1.9.5.msysgit.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Reviewed-by: Eric Dong <eric.dong@intel.com> -----Original Message----- From: Bi, Dandan Sent: Tuesday, August 1, 2017 3:51 PM To: edk2-devel@lists.01.org Cc: Dong, Eric <eric.dong@intel.com>; Gao, Liming <liming.gao@intel.com>; Daniel D�az <daniel.diaz@linaro.org> Subject: [patch] BaseTools/VfrCompile: Remove the MAX_PATH limitation REF: https://bugzilla.tianocore.org/show_bug.cgi?id=579 Since we have already used LongFilePath() to convert file path, so we can remove the MAX_PATH limitation. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Daniel D az <daniel.diaz@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> --- BaseTools/Source/C/VfrCompile/EfiVfr.h | 3 +-- BaseTools/Source/C/VfrCompile/VfrCompiler.cpp | 24 ------------------------ 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/BaseTools/Source/C/VfrCompile/EfiVfr.h b/BaseTools/Source/C/VfrCompile/EfiVfr.h index d187902..10d1257 100644 --- a/BaseTools/Source/C/VfrCompile/EfiVfr.h +++ b/BaseTools/Source/C/VfrCompile/EfiVfr.h @@ -1,9 +1,9 @@ /** @file Defines and prototypes for the UEFI VFR compiler internal use. -Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -17,11 +17,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "Common/UefiBaseTypes.h" #include "Common/UefiInternalFormRepresentation.h" #include "Common/MdeModuleHii.h" -#define MAX_PATH 255 #define MAX_VFR_LINE_LEN 4096 #define EFI_IFR_MAX_LENGTH 0xFF #define MAX_IFR_EXPRESSION_DEPTH 0x9 diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp index e65a925..831f6b5 100644 --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp @@ -117,14 +117,10 @@ CVfrCompiler::OptionInitialization ( Index++; if ((Index >= Argc) || (Argv[Index][0] == '-')) { DebugError (NULL, 0, 1001, "Missing option", "-o missing output directory name"); goto Fail; } - if (strlen (Argv[Index]) > MAX_PATH - 1) { - DebugError (NULL, 0, 1003, "Invalid option value", "Output directory name %s is too long", Argv[Index]); - goto Fail; - } mOptions.OutputDirectory = (CHAR8 *) malloc (strlen (Argv[Index]) + strlen ("\\") + 1); if (mOptions.OutputDirectory == NULL) { DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL); goto Fail; @@ -184,14 +180,10 @@ CVfrCompiler::OptionInitialization ( if (Index != Argc - 1) { DebugError (NULL, 0, 1001, "Missing option", "VFR file name is not specified."); goto Fail; } else { - if (strlen (Argv[Index]) > MAX_PATH) { - DebugError (NULL, 0, 1003, "Invalid option value", "VFR file name %s is too long.", Argv[Index]); - goto Fail; - } mOptions.VfrFileName = (CHAR8 *) malloc (strlen (Argv[Index]) + 1); if (mOptions.VfrFileName == NULL) { DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL); goto Fail; } @@ -353,14 +345,10 @@ CVfrCompiler::SetBaseFileName ( if ((pExt = strchr (pFileName, '.')) == NULL) { return -1; } *pExt = '\0'; - if (strlen (pFileName) > MAX_PATH - 1) { - *pExt = '.'; - return -1; - } mOptions.VfrBaseFileName = (CHAR8 *) malloc (strlen (pFileName) + 1); if (mOptions.VfrBaseFileName == NULL) { *pExt = '.'; return -1; @@ -385,13 +373,10 @@ CVfrCompiler::SetPkgOutputFileName ( Length = strlen (mOptions.OutputDirectory) + strlen (mOptions.VfrBaseFileName) + strlen (VFR_PACKAGE_FILENAME_EXTENSION) + 1; - if (Length > MAX_PATH) { - return -1; - } mOptions.PkgOutputFileName = (CHAR8 *) malloc (Length); if (mOptions.PkgOutputFileName == NULL) { return -1; } @@ -416,13 +401,10 @@ CVfrCompiler::SetCOutputFileName ( Length = strlen (mOptions.OutputDirectory) + strlen (mOptions.VfrBaseFileName) + strlen (".c") + 1; - if (Length > MAX_PATH) { - return -1; - } mOptions.COutputFileName = (CHAR8 *) malloc (Length); if (mOptions.COutputFileName == NULL) { return -1; } @@ -447,13 +429,10 @@ CVfrCompiler::SetPreprocessorOutputFileName ( Length = strlen (mOptions.OutputDirectory) + strlen (mOptions.VfrBaseFileName) + strlen (VFR_PREPROCESS_FILENAME_EXTENSION) + 1; - if (Length > MAX_PATH) { - return -1; - } mOptions.PreprocessorOutputFileName = (CHAR8 *) malloc (Length); if (mOptions.PreprocessorOutputFileName == NULL) { return -1; } @@ -478,13 +457,10 @@ CVfrCompiler::SetRecordListFileName ( Length = strlen (mOptions.OutputDirectory) + strlen (mOptions.VfrBaseFileName) + strlen (VFR_RECORDLIST_FILENAME_EXTENSION) + 1; - if (Length > MAX_PATH) { - return -1; - } mOptions.RecordListFile = (CHAR8 *) malloc (Length); if (mOptions.RecordListFile == NULL) { return -1; } -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.