From cb999dfdaf25d5a774d2ee84cb99355438d57c93 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Thu, 10 May 2012 05:42:47 +0000 Subject: ip(6)tables-restore: make sure argv is NULL terminated Else, argv[argc] may point to free'd memory. Some extensions, e.g. rateest, may fail to parse valid input because argv[optind] (with optind == argc) is not NULL. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso --- iptables/ip6tables-restore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'iptables/ip6tables-restore.c') diff --git a/iptables/ip6tables-restore.c b/iptables/ip6tables-restore.c index 92bdc302..3894d68d 100644 --- a/iptables/ip6tables-restore.c +++ b/iptables/ip6tables-restore.c @@ -98,7 +98,7 @@ static int add_argv(char *what) { DEBUGP("add_argv: %s\n", what); if (what && newargc + 1 < ARRAY_SIZE(newargv)) { newargv[newargc] = strdup(what); - newargc++; + newargv[++newargc] = NULL; return 1; } else { xtables_error(PARAMETER_PROBLEM, -- cgit v1.2.3