Re: [edk2] [Patch V2] BaseTools: Add parameter check for the AsciiStringToUint64

2019-02-23 Thread Gao, Liming
Reviewed-by: Liming Gao 

> -Original Message-
> From: Feng, Bob C
> Sent: Saturday, February 23, 2019 5:42 PM
> To: edk2-devel@lists.01.org
> Cc: Feng, Bob C ; Gao, Liming 
> Subject: [Patch V2] 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 
> Cc: Liming Gao 
> ---
>  BaseTools/Source/C/Common/ParseInf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/C/Common/ParseInf.c 
> b/BaseTools/Source/C/Common/ParseInf.c
> index 3907f44331..c5d79c89fa 100644
> --- a/BaseTools/Source/C/Common/ParseInf.c
> +++ b/BaseTools/Source/C/Common/ParseInf.c
> @@ -506,11 +506,11 @@ Returns:
>Index = 0;
> 
>//
>// Check input parameter
>//
> -  if (AsciiString == NULL || ReturnValue == NULL) {
> +  if (AsciiString == NULL || ReturnValue == NULL || strlen(AsciiString) > 
> 0xFF) {
>  return EFI_INVALID_PARAMETER;
>}
>while (AsciiString[Index] == ' ') {
>  Index ++;
>}
> --
> 2.18.0.windows.1

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


[edk2] [Patch V2] BaseTools: Add parameter check for the AsciiStringToUint64

2019-02-23 Thread Feng, Bob C
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 
Cc: Liming Gao 
---
 BaseTools/Source/C/Common/ParseInf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/Common/ParseInf.c 
b/BaseTools/Source/C/Common/ParseInf.c
index 3907f44331..c5d79c89fa 100644
--- a/BaseTools/Source/C/Common/ParseInf.c
+++ b/BaseTools/Source/C/Common/ParseInf.c
@@ -506,11 +506,11 @@ Returns:
   Index = 0;
 
   //
   // Check input parameter
   //
-  if (AsciiString == NULL || ReturnValue == NULL) {
+  if (AsciiString == NULL || ReturnValue == NULL || strlen(AsciiString) > 
0xFF) {
 return EFI_INVALID_PARAMETER;
   }
   while (AsciiString[Index] == ' ') {
 Index ++;
   }
-- 
2.18.0.windows.1

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