netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Florian Westphal <fw@strlen.de>
Cc: Laura Garcia Liebana <nevola@gmail.com>,
	netfilter-devel@vger.kernel.org, pablo@netfilter.org
Subject: Re: [PATCH nft] parser_json: fix segfault in translating string to nft object
Date: Thu, 11 Apr 2019 12:34:15 +0200	[thread overview]
Message-ID: <20190411103415.GY4851@orbyte.nwl.cc> (raw)
In-Reply-To: <20190411091558.dytqgrgcwelfbhad@breakpoint.cc>

Hi,

On Thu, Apr 11, 2019 at 11:15:58AM +0200, Florian Westphal wrote:
> Laura Garcia Liebana <nevola@gmail.com> wrote:
> > The obj_tbl array is allocated with the maximum element index even
> > if lower indexes are not populated, so it produces null pointer
> > items.
> > 
> > This patch ensures that the maximum number of possible indexes
> > but also the element is not comparing a null pointer.
> 
> Applied, thanks Laura.

Thanks for catching this, Laura!

> >  static int string_to_nft_object(const char *str)
> >  {
> > -	const char *obj_tbl[] = {
> > +	const char *obj_tbl[__NFT_OBJECT_MAX] = {
> >  		[NFT_OBJECT_COUNTER] = "counter",
> >  		[NFT_OBJECT_QUOTA] = "quota",
> >  		[NFT_OBJECT_CT_HELPER] = "ct helper",
> >  		[NFT_OBJECT_LIMIT] = "limit",
> >  		[NFT_OBJECT_SECMARK] = "secmark",
> >  	};
> 
> Phil, does this need updating?
> 
> It looks to me as if this should also init NFT_OBJECT_CT_TIMEOUT and so on.

Actually, it is not strict enough. The function is used when handling
'add map' command. In bison, only counter, quota, limit and secmark are
allowed as stateful object "destination". I suspect ct helper is a
leftover from reusing the function somewhere else. I'll send a patch to
remove it.

Cheers, Phil

      reply	other threads:[~2019-04-11 10:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11  8:59 [PATCH nft] parser_json: fix segfault in translating string to nft object Laura Garcia Liebana
2019-04-11  9:15 ` Florian Westphal
2019-04-11 10:34   ` Phil Sutter [this message]

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=20190411103415.GY4851@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=nevola@gmail.com \
    --cc=pablo@netfilter.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).