libipvs: fix some buffer sizes
Size or length? Here is the answer:
- IP_VS_SCHEDNAME_MAXLEN and IP_VS_IFNAME_MAXLEN are sizes
because they are used in kernel structures exported to user
space for the old setsockopt interface. We can not change
these structures in the kernel.
- IP_VS_PENAME_MAXLEN and IP_VS_PEDATA_MAXLEN are max lengths
because they are not exported to the old interface.
As result:
- buffers should have space for NUL terminator
- strncpy should use sizeof(buffer) - 1 as max length
As we change the libipvs structures, their users should be
recompiled.
Maintainers notes:
This change is related/inspired by kernel commit 52f96757905b
("ipvs: fix buffer overflow with sync daemon and service") found
by syzkaller. While this fix is found by manual review.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
3 files changed