summaryrefslogtreecommitdiffstats
path: root/iptables/xtables-config-parser.y
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2013-03-10 16:56:20 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2013-12-30 23:50:28 +0100
commit275283f176152a84212a37bb043d610077c7435b (patch)
treedc61e572c03cefadf3aa5a5b91ae8f42db42cf2c /iptables/xtables-config-parser.y
parent32c579fa6fa1155f316c202a95d3e946111891bd (diff)
xtables-config: fix off by one in parsed strings from /etc/xtables.conf
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables/xtables-config-parser.y')
-rw-r--r--iptables/xtables-config-parser.y10
1 files changed, 5 insertions, 5 deletions
diff --git a/iptables/xtables-config-parser.y b/iptables/xtables-config-parser.y
index 06b6ca9f..6017e290 100644
--- a/iptables/xtables-config-parser.y
+++ b/iptables/xtables-config-parser.y
@@ -69,7 +69,7 @@ static inline void stack_put_i32(void *data, int value)
static inline void stack_put_str(void *data, const char *str)
{
- memcpy(data, str, strlen(str)+1);
+ memcpy(data, str, strlen(str));
}
static void stack_free(struct stack_elem *e)
@@ -108,7 +108,7 @@ line : family
family : T_FAMILY T_STRING '{' tables '}'
{
- void *data = stack_push(T_FAMILY, strlen($2));
+ void *data = stack_push(T_FAMILY, strlen($2)+1);
stack_put_str(data, $2);
}
;
@@ -120,7 +120,7 @@ tables : table
table : T_TABLE T_STRING '{' chains '}'
{
/* added in reverse order to pop it in order */
- void *data = stack_push(T_TABLE, strlen($2));
+ void *data = stack_push(T_TABLE, strlen($2)+1);
stack_put_str(data, $2);
}
;
@@ -134,9 +134,9 @@ chain : T_CHAIN T_STRING T_HOOK T_STRING T_PRIO T_INTEGER
/* added in reverse order to pop it in order */
void *data = stack_push(T_PRIO, sizeof(int32_t));
stack_put_i32(data, $6);
- data = stack_push(T_HOOK, strlen($4));
+ data = stack_push(T_HOOK, strlen($4)+1);
stack_put_str(data, $4);
- data = stack_push(T_CHAIN, strlen($2));
+ data = stack_push(T_CHAIN, strlen($2)+1);
stack_put_str(data, $2);
}
;