All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org, giuseppelng@gmail.com, kaber@trash.net
Subject: Re: [PATCH] netfilter: nf_tables: set names cannot be larger than 15 bytes
Date: Fri, 28 Mar 2014 12:20:58 +0100	[thread overview]
Message-ID: <20140328112058.GA12878@localhost> (raw)
In-Reply-To: <20140326003250.GC21741@breakpoint.cc>

On Wed, Mar 26, 2014 at 01:32:50AM +0100, Florian Westphal wrote:
> Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > On Mon, Mar 24, 2014 at 11:41:05PM +0100, Florian Westphal wrote:
> > > Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > > > diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
> > > > index 33045a5..43ae487 100644
> > > > --- a/net/netfilter/nf_tables_api.c
> > > > +++ b/net/netfilter/nf_tables_api.c
> > > > @@ -1946,7 +1946,8 @@ static const struct nft_set_ops *nft_select_set_ops(const struct nlattr * const
> > > >  
> > > >  static const struct nla_policy nft_set_policy[NFTA_SET_MAX + 1] = {
> > > >  	[NFTA_SET_TABLE]		= { .type = NLA_STRING },
> > > > -	[NFTA_SET_NAME]			= { .type = NLA_STRING },
> > > > +	[NFTA_SET_NAME]			= { .type = NLA_STRING,
> > > > +					    .len = IFNAMSIZ - 1 },
> > > 
> > > Not related to your patch, but it looks to me as if all of these
> > > should be NLA_NUL_STRING, no?
> > 
> > This is what I originally thought. But all of the nla_* functions use
> > the nla_len to know length of the string coming from userspace, so
> > they don't rely on the trailing nul-termination.
> 
> Indeed.  I reviewed this again but only 'bug' I spotted:
> 
> nf_tables_chain_type_lookup() does:
> request_module("nft-chain-%u-%*.s", ....
> 
> ('%.*s' was probably intended).  Its harmless though as NFTA_CHAIN_TYPE is
> NLA_NUL_STR so the erroneous fmt could also be changed to plain %s.

I think we can change that to NLA_STRING to make it consistent with
other attributes. libnftnl is anyway sending the nul-termination all
the time, so nothing should break IMO.

  reply	other threads:[~2014-03-28 11:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-24 14:10 [PATCH] netfilter: nf_tables: set names cannot be larger than 15 bytes Pablo Neira Ayuso
2014-03-24 22:41 ` Florian Westphal
2014-03-25 20:45   ` Pablo Neira Ayuso
2014-03-26  0:32     ` Florian Westphal
2014-03-28 11:20       ` Pablo Neira Ayuso [this message]
2014-03-28 13:18         ` Florian Westphal

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=20140328112058.GA12878@localhost \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=giuseppelng@gmail.com \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    /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.