From: Giuseppe Longo <giuseppelng@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: Giuseppe Longo <giuseppelng@gmail.com>
Subject: [PATCH] nftables: fix length of set name
Date: Fri, 21 Mar 2014 18:39:01 +0100 [thread overview]
Message-ID: <1395423541-5098-2-git-send-email-giuseppelng@gmail.com> (raw)
In-Reply-To: <1395423541-5098-1-git-send-email-giuseppelng@gmail.com>
This patch permits to copy the last char of the set name
that's currently excluded.
nft add table ip test
nft add chain ip test filter {type filter hook input priority 0 \; }
nft add set ip test thisnamewith0016 { type ipv4_address\;}
nft list table ip test
table ip test {
set thisnamewith0016 {
type ipv4_address
}
chain filter {
type filter hook input priority 0;
}
}
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
---
net/netfilter/nf_tables_api.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index adce01e..a0da542 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -2018,7 +2018,7 @@ static int nf_tables_set_alloc_name(struct nft_ctx *ctx, struct nft_set *set,
free_page((unsigned long)inuse);
}
- snprintf(set->name, sizeof(set->name), name, n);
+ snprintf(set->name, sizeof(set->name)+1, name, n);
list_for_each_entry(i, &ctx->table->sets, list) {
if (!strcmp(set->name, i->name))
return -ENFILE;
@@ -2399,7 +2399,7 @@ static int nf_tables_newset(struct sock *nlsk, struct sk_buff *skb,
if (set == NULL)
goto err1;
- nla_strlcpy(name, nla[NFTA_SET_NAME], sizeof(set->name));
+ nla_strlcpy(name, nla[NFTA_SET_NAME], sizeof(set->name)+1);
err = nf_tables_set_alloc_name(&ctx, set, name);
if (err < 0)
goto err2;
--
1.8.3.2
next prev parent reply other threads:[~2014-03-21 17:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-21 17:39 [nft PATCH] src: check if the set name is too long Giuseppe Longo
2014-03-21 17:39 ` Giuseppe Longo [this message]
2014-03-24 14:57 ` [PATCH] nftables: fix length of set name Pablo Neira Ayuso
2014-03-24 14:57 ` [nft PATCH] src: check if the set name is too long 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=1395423541-5098-2-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.