[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAJ3s=NAf5x3W9spRjxKKnX0Qxoc+nmr3rRkNy5dKYbyXG6mP4g@mail.gmail.com>
Date: Mon, 13 Jun 2016 21:07:19 +0530
From: Kishan Sandeep <sandeepkishan108@...il.com>
To: pablo@...filter.org, netdev@...r.kernel.org
Subject: Re: [PATCH] netfilter: fix buffer null termination
+ netdev
On Sat, Jun 11, 2016 at 10:18 AM, Kishan Sandeep
<sandeepkishan108@...il.com> wrote:
> strncpy generally perferable fo non-terminated
> fixed-width strings. For NULL termination strlcpy
> is preferrable.
>
> Signed-off-by: Kishan Sandeep <sandeepkishan108@...il.com>
> ---
> net/netfilter/xt_repldata.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/netfilter/xt_repldata.h b/net/netfilter/xt_repldata.h
> index 8fd3241..a460211 100644
> --- a/net/netfilter/xt_repldata.h
> +++ b/net/netfilter/xt_repldata.h
> @@ -28,7 +28,7 @@
> if (tbl == NULL) \
> return NULL; \
> term = (struct type##_error *)&(((char *)tbl)[term_offset]); \
> - strncpy(tbl->repl.name, info->name, sizeof(tbl->repl.name)); \
> + strlcpy(tbl->repl.name, info->name, sizeof(tbl->repl.name)); \
> *term = (struct type##_error)typ2##_ERROR_INIT; \
> tbl->repl.valid_hooks = hook_mask; \
> tbl->repl.num_entries = nhooks + 1; \
> --
> 1.7.9.5
>
Powered by blists - more mailing lists