diff mbox

uefirtauthvar: missing return error when mismatch size of set/get test data

Message ID 1425532718-2604-1-git-send-email-ivan.hu@canonical.com
State Accepted
Headers show

Commit Message

Ivan Hu March 5, 2015, 5:18 a.m. UTC
CoverityScan detected a potential buffer overflow, it is because that mismatch
of set and get authenticated variable, this should directly set as ERROR and
return. And no need to compare the further data contents.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/uefi/uefirtauthvar/uefirtauthvar.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Alex Hung March 5, 2015, 6:48 a.m. UTC | #1
On 03/05/2015 01:18 PM, Ivan Hu wrote:
> CoverityScan detected a potential buffer overflow, it is because that mismatch
> of set and get authenticated variable, this should directly set as ERROR and
> return. And no need to compare the further data contents.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/uefi/uefirtauthvar/uefirtauthvar.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/uefi/uefirtauthvar/uefirtauthvar.c b/src/uefi/uefirtauthvar/uefirtauthvar.c
> index 22c954b..3f696ec 100644
> --- a/src/uefi/uefirtauthvar/uefirtauthvar.c
> +++ b/src/uefi/uefirtauthvar/uefirtauthvar.c
> @@ -415,6 +415,7 @@ static int uefirtauthvar_test5(fwts_framework *fw)
>  			"UEFIUpdateAuthVar",
>  			"Get authenticated variable data size is not the "
>  			"same as it set.");
> +		return FWTS_ERROR;
>  	}
>  
>  	for (i = 0; i < getdatasize; i++) {
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Colin Ian King March 5, 2015, 8:03 a.m. UTC | #2
On 05/03/15 05:18, Ivan Hu wrote:
> CoverityScan detected a potential buffer overflow, it is because that mismatch
> of set and get authenticated variable, this should directly set as ERROR and
> return. And no need to compare the further data contents.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/uefi/uefirtauthvar/uefirtauthvar.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/uefi/uefirtauthvar/uefirtauthvar.c b/src/uefi/uefirtauthvar/uefirtauthvar.c
> index 22c954b..3f696ec 100644
> --- a/src/uefi/uefirtauthvar/uefirtauthvar.c
> +++ b/src/uefi/uefirtauthvar/uefirtauthvar.c
> @@ -415,6 +415,7 @@ static int uefirtauthvar_test5(fwts_framework *fw)
>  			"UEFIUpdateAuthVar",
>  			"Get authenticated variable data size is not the "
>  			"same as it set.");
> +		return FWTS_ERROR;
>  	}
>  
>  	for (i = 0; i < getdatasize; i++) {
>
Thanks Ivan

Acked-by: Colin Ian King <colin.king@canonical.com>
diff mbox

Patch

diff --git a/src/uefi/uefirtauthvar/uefirtauthvar.c b/src/uefi/uefirtauthvar/uefirtauthvar.c
index 22c954b..3f696ec 100644
--- a/src/uefi/uefirtauthvar/uefirtauthvar.c
+++ b/src/uefi/uefirtauthvar/uefirtauthvar.c
@@ -415,6 +415,7 @@  static int uefirtauthvar_test5(fwts_framework *fw)
 			"UEFIUpdateAuthVar",
 			"Get authenticated variable data size is not the "
 			"same as it set.");
+		return FWTS_ERROR;
 	}
 
 	for (i = 0; i < getdatasize; i++) {