All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Kishan Sandeep <sandeepkishan108@gmail.com>
Cc: netdev@vger.kernel.org, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: fix buffer null termination
Date: Tue, 14 Jun 2016 17:08:02 +0200	[thread overview]
Message-ID: <20160614150802.GA1029@salvia> (raw)
In-Reply-To: <CAJ3s=NBCvYnRaWcFb==vZqP1_YE6w=uKqbtBvESkCo1sED2CHg@mail.gmail.com>

Cc'ing netfilter-devel.

On Tue, Jun 14, 2016 at 07:39:27PM +0530, Kishan Sandeep wrote:
> + netdev
> 
> On Sat, Jun 11, 2016 at 10:18 AM, Kishan Sandeep
> <sandeepkishan108@gmail.com> wrote:
> > strncpy generally perferable fo non-terminated
> > fixed-width strings. For NULL termination strlcpy
> > is preferrable.
> >
> > Signed-off-by: Kishan Sandeep <sandeepkishan108@gmail.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)); \

I don't think this is actually fixing anything. Tables in x_tables
have a known and fixed name that is defined from the kernel side, that
is always smaller that the buffer we have there. So are you observing
any real problem from there?

Thanks.

  reply	other threads:[~2016-06-14 15:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1465620484-5543-1-git-send-email-sandeepkishan108@gmail.com>
2016-06-13 15:37 ` [PATCH] netfilter: fix buffer null termination Kishan Sandeep
2016-06-14 14:09 ` Kishan Sandeep
2016-06-14 15:08   ` Pablo Neira Ayuso [this message]
2016-06-14 16:22     ` Kishan Sandeep
2016-06-15 12:17       ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160614150802.GA1029@salvia \
    --to=pablo@netfilter.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=sandeepkishan108@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.