iptables-restore: fix segmentation fault with -tanything
commitd0cbf5f34d3421064eb0fbbcdc6b90cda4e81f2d
authorJan Engelhardt <jengelh@medozas.de>
Mon, 4 Aug 2008 10:51:01 +0000 (4 12:51 +0200)
committerPatrick McHardy <kaber@trash.net>
Mon, 4 Aug 2008 10:51:01 +0000 (4 12:51 +0200)
tree1a271189fda828a4dbe4b89a8194d8d8c47444a9
parent415a8580cc2b053687c197e8e25d606e8420c672
iptables-restore: fix segmentation fault with -tanything

Reference: Debian bug #458042

iptables-restore must not pass a table into do_command. It checks for
"-t arg" and "--table arg", but not "-targ". (On a related note,
using -targ does not work as expected).

This should fail gracefully, but crashes:

iptables-restore <(echo -e '*filter\n-A INPUT -tx\nCOMMIT')

And this should use table "filter", or perhaps raise an error, but
instead sets the table to (literally) "-tfilter":

iptables -tfilter -A INPUT

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
ip6tables-restore.c
ip6tables.c
iptables-restore.c
iptables.c