ACK: [PATCH] lib: fwts_args: use strncpy instead of strcpy

ivanhu ivan.hu at canonical.com
Fri May 29 06:49:20 UTC 2015



On 2015年05月14日 19:33, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Coverity Scan was flagging up the use of strcpy and of a potential
> buffer overrun, so use strncpy instead.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/lib/src/fwts_args.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c
> index 86e0d4b..5dc9261 100644
> --- a/src/lib/src/fwts_args.c
> +++ b/src/lib/src/fwts_args.c
> @@ -299,8 +299,8 @@ void fwts_args_show_options(void)
>   				}
>   			}
>   		}
> -		strcat(ptr, "--");
> -		strcat(ptr, option->long_name);
> +		strncat(ptr, "--", ptr - buffer - 1);
> +		strncat(ptr, option->long_name, ptr - buffer - 3);
>   
>   		fwts_args_show_option(width, buffer, option->explanation);
>   	}
Acked-by: Ivan Hu<ivan.hu at canonical.com>



More information about the fwts-devel mailing list