]> git.ipfire.org Git - thirdparty/iptables.git/commit
src: fix discards 'const' qualifier
authorRudi Heitbaum <rudi@heitbaum.com>
Fri, 20 Feb 2026 09:37:46 +0000 (09:37 +0000)
committerFlorian Westphal <fw@strlen.de>
Sun, 22 Feb 2026 18:07:47 +0000 (19:07 +0100)
commit342291e0ff56fb33bc62f9131ce2eab18d0b357d
tree42f18fb6ea19fcf1d589a3c8342994addfb6adab
parentb176df1c23b458b4510034281a86f0a96341d7a1
src: fix discards 'const' qualifier

argv is passed by parse_change_counters_rule and do_parse to parse_rule_range
as a const char. parse_rule_range modifies thepassed in argv, so pass as
non const so that it can be modified without warning.

Fixes:
iptables/xshared.c: In function 'parse_rule_range':
iptables/xshared.c:912:23: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
 912 |         char *colon = strchr(argv, ':'), *buffer;
     |                       ^~~~~~

p is used as the return from strchr(sctp_chunk_names[i].valid_flags)
which is a const char. Declare p as a const char * pointer for use
addressing the warning.

Fixes:
extensions/libxt_sctp.c: In function 'parse_sctp_chunk':
extensions/libxt_sctp.c:211:40: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  211 |                                 if ((p = strchr(sctp_chunk_names[i].valid_flags,
      |                                        ^

next is used as the return from strchr(loop) which is a const char.
Declare next as a const char * pointer for use addressing the warning.

Fixes:
 libxtables/xtables.c: In function 'xtables_ipparse_multiple':
 libxtables/xtables.c:1767:22: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
 1767 |                 next = strchr(loop, ',');
      |                      ^
 libxtables/xtables.c: In function 'xtables_ip6parse_multiple':
 libxtables/xtables.c:2066:22: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
 2066 |                 next = strchr(loop, ',');
      |                      ^

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
extensions/libxt_sctp.c
iptables/xshared.c
libxtables/xtables.c