summaryrefslogtreecommitdiffstats
path: root/iptables-restore.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2001-10-16 07:53:34 +0000
committerHarald Welte <laforge@gnumonks.org>2001-10-16 07:53:34 +0000
commitfe127c980e510953149cece424963152c90ab111 (patch)
tree16c02d7d7c1afa860fb85ff3ca7e941861a1e584 /iptables-restore.c
parentfa97236437d19e1e55dd011828c461469d78d295 (diff)
prevent ip(6)tables-restore from crashing when a line contains -t
Diffstat (limited to 'iptables-restore.c')
-rw-r--r--iptables-restore.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/iptables-restore.c b/iptables-restore.c
index 2f4d8768..8465beb1 100644
--- a/iptables-restore.c
+++ b/iptables-restore.c
@@ -4,7 +4,7 @@
*
* This coude is distributed under the terms of GNU GPL
*
- * $Id: iptables-restore.c,v 1.13 2001/06/16 18:25:25 laforge Exp $
+ * $Id: iptables-restore.c,v 1.14 2001/08/06 18:50:22 laforge Exp $
*/
#include <getopt.h>
@@ -289,6 +289,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);