Bob: This function is used to convert string to UINT64. So, the string len should not be too long. I think UINT8 max value 255 is enough for its usage.
Thanks Liming > -----Original Message----- > From: Feng, Bob C > Sent: Friday, February 22, 2019 6:05 PM > To: edk2-devel@lists.01.org > Cc: Feng, Bob C <bob.c.f...@intel.com>; Gao, Liming <liming....@intel.com> > Subject: [Patch] BaseTools: Add parameter check for the AsciiStringToUint64 > > 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