summaryrefslogtreecommitdiffstats
path: root/iptables/iptables-restore.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2022-03-15 12:17:25 +0100
committerPhil Sutter <phil@nwl.cc>2022-03-15 14:53:52 +0100
commit0c8e253595bd80e4ddd73230d079e33cd5420b32 (patch)
tree4d6cd929cc05ba0e4ad53117a599dfb889e413e4 /iptables/iptables-restore.c
parent0c0cd4340ed88fdd2e80d2d5ffc5886c41f5dee0 (diff)
libxtables: Fix for warning in xtables_ipmask_to_numeric
Gcc complains: | xtables.c: In function 'xtables_ipmask_to_numeric': | xtables.c:1491:34: warning: '__builtin___sprintf_chk' may write a terminating nul past the end of the destination [-Wformat-overflow=] | 1491 | sprintf(buf, "/%s", xtables_ipaddr_to_numeric(mask)); | | ^ Indeed, xtables_ipaddr_to_numeric() returns a pointer to a 20 byte buffer and xtables_ipmask_to_numeric() writes its content into a buffer of same size at offset 1. Yet length of returned string is deterministic as it is an IPv4 address. So shrink it to the minimum of 16 bytes which eliminates the warning as well. Fixes: a96166c24eaac ("libxtables: add xtables_ip[6]mask_to_cidr") Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/iptables-restore.c')
0 files changed, 0 insertions, 0 deletions