summaryrefslogtreecommitdiffstats
path: root/ip6tables-restore.c
diff options
context:
space:
mode:
authorlaforge <laforge>2001-10-16 07:53:34 +0000
committerlaforge <laforge>2001-10-16 07:53:34 +0000
commitbd611f2e61d8fb48f46abf69f5f9494314b1176d (patch)
tree16c02d7d7c1afa860fb85ff3ca7e941861a1e584 /ip6tables-restore.c
parent6086820033fe09298e98aff87f7fc082df57dc5d (diff)
prevent ip(6)tables-restore from crashing when a line contains -t
Diffstat (limited to 'ip6tables-restore.c')
-rw-r--r--ip6tables-restore.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/ip6tables-restore.c b/ip6tables-restore.c
index 5be8a1f..d0c778a 100644
--- a/ip6tables-restore.c
+++ b/ip6tables-restore.c
@@ -294,6 +294,22 @@ int main(int argc, char *argv[])
parsestart = buffer;
}
+ /* prevent iptables-restore from crashing in do_command
+ * when someone passes a "-t" on the line.
+ * - Ben Reser <ben@reser.org> */
+ if (strstr(buffer, "-t")) {
+ exit_error(PARAMETER_PROBLEM,
+ "Line %u seems to have a "
+ " -t table option.\n", line);
+ exit(1);
+ }
+ if (!strlen((char *) &curtable)) {
+ exit_error(PARAMETER_PROBLEM,
+ "Line %u seems to to have a "
+ " zero-length table name.\n", line);
+ exit(1);
+ }
+
add_argv(argv[0]);
add_argv("-t");
add_argv((char *) &curtable);