diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-03-10 16:56:20 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-12-30 23:50:28 +0100 |
commit | 275283f176152a84212a37bb043d610077c7435b (patch) | |
tree | dc61e572c03cefadf3aa5a5b91ae8f42db42cf2c | |
parent | 32c579fa6fa1155f316c202a95d3e946111891bd (diff) |
xtables-config: fix off by one in parsed strings from /etc/xtables.conf
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | iptables/xtables-config-parser.y | 10 |
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); } ; |