]> git.ipfire.org Git - thirdparty/iptables.git/commit
libiptc: Avoid gcc-10 zero-length array warning
authorPhil Sutter <phil@nwl.cc>
Thu, 8 Oct 2020 12:51:52 +0000 (14:51 +0200)
committerPhil Sutter <phil@nwl.cc>
Mon, 12 Oct 2020 11:27:23 +0000 (13:27 +0200)
commitc6cff7ddd4ee8ac8b500a9c928612acf39bfa9ec
tree7e20e8dcb1e1b1f17716705452e17cb3a6f426dc
parent0bd7a8eaf3582159490ab355b1217a4e42ed021f
libiptc: Avoid gcc-10 zero-length array warning

Gcc-10 doesn't like the use of zero-length arrays as last struct member
to denote variable sized objects. The suggested alternative, namely to
use a flexible array member as defined by C99, is problematic as that
doesn't allow for said struct to be embedded into others. With the
relevant structs being part of kernel UAPI, this can't be precluded
though.

The call to memcpy() which triggers the warning copies data from one
struct xt_counters to another. Since this struct is flat and merely
contains two u64 fields, One can use direct assignment instead which
avoids the warning.

Signed-off-by: Phil Sutter <phil@nwl.cc>
libiptc/libiptc.c