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.
- 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
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 <firstname.lastname@example.org>
Acked-by: Simon Horman <email@example.com>
Signed-off-by: Jesper Dangaard Brouer <firstname.lastname@example.org>
3 files changed