summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Falgueras García <carlosfg@riseup.net>2016-07-05 19:15:16 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2016-07-06 17:14:48 +0200
commit8f1e916b9856785cb835a2d550c9605e86937055 (patch)
tree429eccb1a78d83688c6ed5497593b687a26ae9c3
parent8a593d1cf97a90e750b53f4387ef19da8d7fc574 (diff)
src: Fix missing nul-termination in nftnl_*_set_str()
The string length must be one character longer to include the nul-termination. Signed-off-by: Carlos Falgueras García <carlosfg@riseup.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/chain.c2
-rw-r--r--src/rule.c2
-rw-r--r--src/set.c2
-rw-r--r--src/set_elem.c2
-rw-r--r--src/table.c2
5 files changed, 5 insertions, 5 deletions
diff --git a/src/chain.c b/src/chain.c
index bfffbe0..cab64b5 100644
--- a/src/chain.c
+++ b/src/chain.c
@@ -260,7 +260,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_chain_set_u8, nft_chain_attr_set_u8);
int nftnl_chain_set_str(struct nftnl_chain *c, uint16_t attr, const char *str)
{
- return nftnl_chain_set_data(c, attr, str, strlen(str));
+ return nftnl_chain_set_data(c, attr, str, strlen(str) + 1);
}
EXPORT_SYMBOL_ALIAS(nftnl_chain_set_str, nft_chain_attr_set_str);
diff --git a/src/rule.c b/src/rule.c
index c87fea7..2b23c8e 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -198,7 +198,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_rule_set_u64, nft_rule_attr_set_u64);
int nftnl_rule_set_str(struct nftnl_rule *r, uint16_t attr, const char *str)
{
- return nftnl_rule_set_data(r, attr, str, strlen(str));
+ return nftnl_rule_set_data(r, attr, str, strlen(str) + 1);
}
EXPORT_SYMBOL_ALIAS(nftnl_rule_set_str, nft_rule_attr_set_str);
diff --git a/src/set.c b/src/set.c
index 9315bf0..e48ff78 100644
--- a/src/set.c
+++ b/src/set.c
@@ -203,7 +203,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_set_set_u64, nft_set_attr_set_u64);
int nftnl_set_set_str(struct nftnl_set *s, uint16_t attr, const char *str)
{
- return nftnl_set_set(s, attr, str);
+ return nftnl_set_set_data(s, attr, str, strlen(str) + 1);
}
EXPORT_SYMBOL_ALIAS(nftnl_set_set_str, nft_set_attr_set_str);
diff --git a/src/set_elem.c b/src/set_elem.c
index 00b7327..40b5bfe 100644
--- a/src/set_elem.c
+++ b/src/set_elem.c
@@ -149,7 +149,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_set_elem_set_u64, nft_set_elem_attr_set_u64);
int nftnl_set_elem_set_str(struct nftnl_set_elem *s, uint16_t attr, const char *str)
{
- return nftnl_set_elem_set(s, attr, str, strlen(str));
+ return nftnl_set_elem_set(s, attr, str, strlen(str) + 1);
}
EXPORT_SYMBOL_ALIAS(nftnl_set_elem_set_str, nft_set_elem_attr_set_str);
diff --git a/src/table.c b/src/table.c
index 32d119f..966b923 100644
--- a/src/table.c
+++ b/src/table.c
@@ -131,7 +131,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_table_set_u8, nft_table_attr_set_u8);
int nftnl_table_set_str(struct nftnl_table *t, uint16_t attr, const char *str)
{
- return nftnl_table_set_data(t, attr, str, 0);
+ return nftnl_table_set_data(t, attr, str, strlen(str) + 1);
}
EXPORT_SYMBOL_ALIAS(nftnl_table_set_str, nft_table_attr_set_str);