public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: Add parameter check for the AsciiStringToUint64
@ 2019-02-22 10:05 Feng, Bob C
  2019-02-22 15:48 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Feng, Bob C @ 2019-02-22 10:05 UTC (permalink / raw)
  To: edk2-devel; +Cc: Bob Feng, Liming Gao

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.feng@intel.com>
Cc: Liming Gao <liming.gao@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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-22 15:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-22 10:05 [Patch] BaseTools: Add parameter check for the AsciiStringToUint64 Feng, Bob C
2019-02-22 15:48 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox