If the input parameter AsciiString length is greater
than 255, the GenFv will hang.

This patch is to fix this issue.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.f...@intel.com>
Cc: Liming Gao <liming....@intel.com>
---
 BaseTools/Source/C/Common/ParseInf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/Common/ParseInf.c 
b/BaseTools/Source/C/Common/ParseInf.c
index 3907f44331..b29f4c2f93 100644
--- a/BaseTools/Source/C/Common/ParseInf.c
+++ b/BaseTools/Source/C/Common/ParseInf.c
@@ -493,11 +493,11 @@ Returns:
   EFI_SUCCESS   Number successfully converted.
   EFI_ABORTED   Invalid character encountered.
 
 --*/
 {
-  UINT8   Index;
+  UINT32   Index;
   UINT64  Value;
   CHAR8   CurrentChar;
 
   //
   // Initialize the result
@@ -506,11 +506,11 @@ Returns:
   Index = 0;
 
   //
   // Check input parameter
   //
-  if (AsciiString == NULL || ReturnValue == NULL) {
+  if (AsciiString == NULL || ReturnValue == NULL || strlen(AsciiString) > 
0xFFFFFFFF) {
     return EFI_INVALID_PARAMETER;
   }
   while (AsciiString[Index] == ' ') {
     Index ++;
   }
-- 
2.20.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to