[PATCH] lib: fix compile error for debian + gcc 8.3

Colin Ian King colin.king at canonical.com
Fri Jan 15 18:20:52 UTC 2021


On 15/01/2021 18:18, Alex Hung wrote:
> Fixes: ffea02df09d3 ("add fwts_acpi_space_id_check to check GAS ...")
> 
> Reported-by: Rebecca Cran <rebecca at nuviainc.com>
> Signed-off-by: Alex Hung <alex.hung at canonical.com>
> ---
>  src/lib/src/fwts_acpi_tables.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index d88d31e4..a42157be 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -1680,9 +1680,9 @@ void fwts_acpi_space_id_check(
>  
>  		strncat(must_be_id, get_space_id_name(must_be), strlen(get_space_id_name(must_be)));
>  		if (i < num_type - 2)
> -			strncat(must_be_id, ", ", 2);
> +			strncat(must_be_id, ", ", 3);
>  		else if (i == num_type - 2)
> -			strncat(must_be_id, " or ", 4);
> +			strncat(must_be_id, " or ", 5);
>  	}
>  
>  	if (!matched) {
> 

I'm surprised some of our static analyzers didn't spot this.

Ultimately we should move to using the BSD strlcat as it's safer.

Acked-by: Colin Ian King <colin.king at canonical.com>



More information about the fwts-devel mailing list