]> git.ipfire.org Git - thirdparty/nftables.git/commit
netlink: don't crash if prefix for < byte is requested
authorFlorian Westphal <fw@strlen.de>
Thu, 14 Dec 2023 14:39:27 +0000 (15:39 +0100)
committerFlorian Westphal <fw@strlen.de>
Thu, 14 Dec 2023 16:53:43 +0000 (17:53 +0100)
commit0404ff08b3c18052e6689d75fa85275d3cef7e8e
treef790890dd3b7017cf86c9937f8bc4705bb516e7d
parent21657008dd4b4094eac017a175f2a3056af36b17
netlink: don't crash if prefix for < byte is requested

If prefix is used with a datatype that has less than 8 bits an
assertion is triggered:

src/netlink.c:243: netlink_gen_raw_data: Assertion `len > 0' failed.

This is esoteric, the alternative would be to restrict prefixes
to ipv4/ipv6 addresses.

Simpler fix is to use round_up instead of divide.

Signed-off-by: Florian Westphal <fw@strlen.de>
src/netlink_linearize.c
tests/py/ip/ip.t
tests/py/ip/ip.t.json
tests/py/ip/ip.t.payload
tests/py/ip/ip.t.payload.bridge
tests/py/ip/ip.t.payload.inet
tests/py/ip/ip.t.payload.netdev