From: Patrick McHardy <kaber@trash.net>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH libnftnl 2/5] data: increase maximum possible data size
Date: Tue, 14 Apr 2015 08:00:34 +0100 [thread overview]
Message-ID: <1428994837-22120-3-git-send-email-kaber@trash.net> (raw)
In-Reply-To: <1428994837-22120-1-git-send-email-kaber@trash.net>
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
include/data_reg.h | 3 ++-
include/linux/netfilter/nf_tables.h | 3 +++
src/expr/data_reg.c | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/data_reg.h b/include/data_reg.h
index e7375b8..cf14988 100644
--- a/include/data_reg.h
+++ b/include/data_reg.h
@@ -1,6 +1,7 @@
#ifndef _DATA_H_
#define _DATA_H_
+#include <linux/netfilter/nf_tables.h>
#include <stdint.h>
#include <unistd.h>
@@ -13,7 +14,7 @@ enum {
union nft_data_reg {
struct {
- uint32_t val[4];
+ uint32_t val[NFT_DATA_VALUE_MAXLEN / sizeof(uint32_t)];
uint32_t len;
};
struct {
diff --git a/include/linux/netfilter/nf_tables.h b/include/linux/netfilter/nf_tables.h
index 4221a6c..be8584c 100644
--- a/include/linux/netfilter/nf_tables.h
+++ b/include/linux/netfilter/nf_tables.h
@@ -388,6 +388,9 @@ enum nft_data_attributes {
};
#define NFTA_DATA_MAX (__NFTA_DATA_MAX - 1)
+/* Maximum length of a value */
+#define NFT_DATA_VALUE_MAXLEN 64
+
/**
* enum nft_verdict_attributes - nf_tables verdict netlink attributes
*
diff --git a/src/expr/data_reg.c b/src/expr/data_reg.c
index b4e553e..b5fbdf2 100644
--- a/src/expr/data_reg.c
+++ b/src/expr/data_reg.c
@@ -467,7 +467,7 @@ __nft_parse_data(union nft_data_reg *data, const struct nlattr *attr)
if (data_len == 0)
return -1;
- if (data_len > sizeof(uint32_t) * 4)
+ if (data_len > sizeof(data->val))
return -1;
memcpy(data->val, orig, data_len);
--
2.1.0
next prev parent reply other threads:[~2015-04-14 7:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-14 7:00 [PATCH libnftnl 0/5] concatenation and dynamic expression instantiation Patrick McHardy
2015-04-14 7:00 ` [PATCH libnftnl 1/5] headers: resync headers for new register definitions Patrick McHardy
2015-04-14 7:00 ` Patrick McHardy [this message]
2015-04-14 7:00 ` [PATCH libnftnl 3/5] expr: seperate expression parsing and building functions Patrick McHardy
2015-04-14 7:00 ` [PATCH libnftnl 4/5] set_elem: support expressions attached to set elements Patrick McHardy
2015-04-14 7:00 ` [PATCH libnftnl 5/5] dynset: support expression templates Patrick McHardy
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=1428994837-22120-3-git-send-email-kaber@trash.net \
--to=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--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).