]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
ebtables: Fix error message for invalid parameters
authorPhil Sutter <phil@nwl.cc>
Mon, 22 Jul 2019 10:16:18 +0000 (12:16 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 23 Jul 2019 19:14:40 +0000 (21:14 +0200)
With empty ruleset, ebtables-nft would report the wrong argv:

| % sudo ./install/sbin/ebtables-nft -vnL
| ebtables v1.8.3 (nf_tables): Unknown argument: './install/sbin/ebtables-nft'
| Try `ebtables -h' or 'ebtables --help' for more information.

After a (successful) call to 'ebtables-nft -L', this would even
segfault:

| % sudo ./install/sbin/ebtables-nft -vnL
| zsh: segmentation fault  sudo ./install/sbin/ebtables-nft -vnL

Fixes: acde6be32036f ("ebtables-translate: Fix segfault while parsing extension options")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/xtables-eb.c

index 171f41b0f616ecf73e935d743b43c88674ac2efb..b8d89ad974a42eb20b676441c3f9bec359b7e423 100644 (file)
@@ -1180,7 +1180,7 @@ print_zero:
                        if (ebt_command_default(&cs))
                                xtables_error(PARAMETER_PROBLEM,
                                              "Unknown argument: '%s'",
-                                             argv[optind - 1]);
+                                             argv[optind]);
 
                        if (command != 'A' && command != 'I' &&
                            command != 'D' && command != 'C')