Files
radvd/device-common.c
Robin H. Johnson 56f31f469e Fix -Wstringop-truncation warning: s/strncpy/strlcpy/
GCC8 added a warning for string truncation that fires on the interface
name handling.

Use the same fix as found in iproute2 to solve it, replacing `strncpy(dst, src, sz-1)`
with `memset(dst, NULL, size)` and then `strlcpy(dst, src, sizeof(dst))`.

`strlcpy` ensures NULL terminated strings in all cases where `strncpy`
does not.

Reference: https://patchwork.ozlabs.org/project/netdev/patch/20180319165638.30166-3-stephen@networkplumber.org/
Reference: https://developers.redhat.com/blog/2018/05/24/detecting-string-truncation-with-gcc-8
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
2023-01-03 15:16:45 -08:00

6.4 KiB