From: Giuseppe Longo <giuseppelng@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: Giuseppe Longo <giuseppelng@gmail.com>
Subject: [nft PATCH] src: check if the set name is too long
Date: Thu, 20 Mar 2014 17:20:03 +0100 [thread overview]
Message-ID: <1395332403-3823-1-git-send-email-giuseppelng@gmail.com> (raw)
checks if the name of set is larger than 15 chars
before to add it.
If so, the set is not added and an error message is printed.
I didn't figure out why, but another error message is printed, see below:
nft add set ip test thenameofthissetistoolooong { type ipv4_address\; }
<cmdline>:1:17-43: Error: set name is too long (> 16)
add set ip test thenameofthissetistoolooong { type ipv4_address; }
^^^^^^^^^^^^^^^^^^^^^^^^^^^
<cmdline>:1:66-66: Error: syntax error, unexpected '}'
add set ip test thenameofthissetistoolooong { type ipv4_address; }
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
---
src/parser.y | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/parser.y b/src/parser.y
index db6f493..17fbd5e 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -15,6 +15,7 @@
#include <inttypes.h>
#include <netinet/ip.h>
#include <netinet/if_ether.h>
+#include <net/if.h>
#include <linux/netfilter.h>
#include <linux/netfilter/nf_tables.h>
#include <linux/netfilter/nf_conntrack_tuple_common.h>
@@ -986,6 +987,11 @@ chain_identifier : identifier
set_spec : table_spec identifier
{
+ if (strlen($2) > IFNAMSIZ) {
+ erec_queue(error(&@2, "set name too long (> %d)", IFNAMSIZ),
+ state->msgs);
+ YYERROR;
+ }
$$ = $1;
$$.set = $2;
}
@@ -993,6 +999,12 @@ set_spec : table_spec identifier
set_identifier : identifier
{
+ if (strlen($1) > IFNAMSIZ) {
+ erec_queue(error(&@1, "set name too long (> %d", IFNAMSIZ),
+ state->msgs);
+ YYERROR;
+ }
+
memset(&$$, 0, sizeof($$));
$$.set = $1;
}
--
1.8.3.2
next reply other threads:[~2014-03-20 16:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-20 16:20 Giuseppe Longo [this message]
2014-03-21 7:24 ` [nft PATCH] src: check if the set name is too long Tomasz Bursztyka
2014-03-21 9:56 ` Pablo Neira Ayuso
[not found] ` <CAG7Tj4qscXJbuMU+vFo10jFmk1Reu2x+C9WMDaFQskN1t3UZ2w@mail.gmail.com>
2014-03-21 10:43 ` Tomasz Bursztyka
-- strict thread matches above, loose matches on Subject: below --
2014-03-21 17:39 Giuseppe Longo
2014-03-24 14:57 ` Pablo Neira Ayuso
2014-03-25 7:37 ` Tomasz Bursztyka
2014-03-25 8:41 ` Pablo Neira Ayuso
2014-03-25 8:47 ` 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=1395332403-3823-1-git-send-email-giuseppelng@gmail.com \
--to=giuseppelng@gmail.com \
--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.