sd-radv: fix potential buffer overflow

Fixes a bug in 1925f829ab and
6a6d27bc5b (v255).
This commit is contained in:
Yu Watanabe 2024-02-19 09:30:17 +09:00 committed by Luca Boccassi
parent b5b2510800
commit ac63c8df30

View file

@ -146,9 +146,9 @@ static int radv_send(sd_radv *ra, const struct in6_addr *dst, usec_t lifetime_us
.nd_opt_mtu_type = ND_OPT_MTU,
.nd_opt_mtu_len = 1,
};
/* Reserve iov space for RA header, linkaddr, MTU, N prefixes, N routes, RDNSS
and DNSSL */
struct iovec iov[5 + ra->n_prefixes + ra->n_route_prefixes];
/* Reserve iov space for RA header, linkaddr, MTU, N prefixes, N routes, N pref64 prefixes, RDNSS,
* DNSSL, and home agent. */
struct iovec iov[6 + ra->n_prefixes + ra->n_route_prefixes + ra->n_pref64_prefixes];
struct msghdr msg = {
.msg_name = &dst_addr,
.msg_namelen = sizeof(dst_addr),