]> git.ipfire.org Git - thirdparty/iptables.git/commit
xshared: Fix parsing of option arguments in same word
authorPhil Sutter <phil@nwl.cc>
Fri, 28 Apr 2023 12:41:08 +0000 (14:41 +0200)
committerPhil Sutter <phil@nwl.cc>
Fri, 28 Apr 2023 13:05:45 +0000 (15:05 +0200)
commit90a7a183a208b691810b8519cc57d3d9d3b7eb60
tree4ba88802d9d4a1fa41f4022f4fd48ce52fb8f4b1
parent79f93b0943fa0e46ba29bb476362634509eb594e
xshared: Fix parsing of option arguments in same word

When merging commandline parsers, a decision between 'argv[optind - 1]'
and 'optarg' had to be made in some spots. While the implementation of
check_inverse() required the former, use of the latter allows for the
common syntax of '--opt=arg' or even '-oarg' as 'optarg' will point at
the suffix while 'argv[optind - 1]' will just point at the following
option.

Fix the mess by making check_inverse() update optarg pointer if needed
so calling code may refer to and always correct 'optarg'.

Fixes: 0af80a91b0a98 ("nft: Merge xtables-arp-standalone.c into xtables-standalone.c")
Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1677
Signed-off-by: Phil Sutter <phil@nwl.cc>
extensions/libarpt_standard.t
extensions/libxt_standard.t
iptables/xshared.c