[PATCH] utilities: kernelscan: use memmove instead of strcpy
Keng-Yu Lin
keng-yu.lin at canonical.com
Tue Jul 22 08:56:30 UTC 2014
On Tue, Jul 15, 2014 at 8:54 PM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> better to use memmove rather than strcpy; Coverity Scan reports
> that there is a potential overlap with the underlying memory copy
> so use memmove which has the smarts to do this correctly.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/utilities/kernelscan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/utilities/kernelscan.c b/src/utilities/kernelscan.c
> index 1b793bb..78c70d5 100644
> --- a/src/utilities/kernelscan.c
> +++ b/src/utilities/kernelscan.c
> @@ -741,7 +741,7 @@ static void literal_strip_quotes(token *t)
>
> t->token[len-1] = 0;
>
> - strcpy(t->token, t->token + 1);
> + memmove(t->token, t->token + 1, len - 1);
> }
>
> /*
> --
> 2.0.1
>
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>
More information about the fwts-devel
mailing list