From: Florian Westphal <fw@strlen.de>
To: Laura Garcia Liebana <nevola@gmail.com>
Cc: netfilter-devel@vger.kernel.org, pablo@netfilter.org, phil@nwl.cc
Subject: Re: [PATCH nft] parser_json: fix segfault in translating string to nft object
Date: Thu, 11 Apr 2019 11:15:58 +0200 [thread overview]
Message-ID: <20190411091558.dytqgrgcwelfbhad@breakpoint.cc> (raw)
In-Reply-To: <20190411085940.l47vszzffm4e3e3c@nevthink>
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.
> 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.
next prev parent reply other threads:[~2019-04-11 9:16 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 [this message]
2019-04-11 10:34 ` Phil Sutter
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=20190411091558.dytqgrgcwelfbhad@breakpoint.cc \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=nevola@gmail.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
/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).