ACK: [PATCH 1/3] lib: fix array size too small to fit the output

Colin Ian King colin.king at canonical.com
Mon Jul 30 05:51:06 UTC 2018


On 25/07/18 06:56, Alex Hung wrote:
> This also fixes gcc 8 complaining "directive output may be truncated
> writing ... [-Werror=format-truncation=]" messages
> 
> Signed-off-by: Alex Hung <alex.hung at canonical.com>
> ---
>  src/lib/src/fwts_acpi_object_eval.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib/src/fwts_acpi_object_eval.c b/src/lib/src/fwts_acpi_object_eval.c
> index 7ff7b6a..0bc0f13 100644
> --- a/src/lib/src/fwts_acpi_object_eval.c
> +++ b/src/lib/src/fwts_acpi_object_eval.c
> @@ -353,7 +353,7 @@ static void fwts_acpi_object_dump_recursive(
>  	const int index)
>  {
>  	uint32_t i;
> -	char index_buf[5];
> +	char index_buf[6];
>  	ACPI_BUFFER buffer;
>  	ACPI_STATUS status;
>  	char full_name[128];
> @@ -362,7 +362,7 @@ static void fwts_acpi_object_dump_recursive(
>  	buffer.Pointer = full_name;
>  
>  	if (index > -1)
> -		snprintf(index_buf, sizeof(index_buf), "%2.2d: ", index);
> +		snprintf(index_buf, sizeof(index_buf), "%2.2d: ", (uint8_t) index);
>  	else
>  		index_buf[0] = '\0';
>  
> 
Acked-by: Colin Ian King <colin.king at canonical.com>



More information about the fwts-devel mailing list