net: l2: ppp: ipv6cp: add assert to check the link address length

This ensures that the configured link address is
at least as big as the part of it that is used.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
This commit is contained in:
Tomi Fontanilles 2024-02-06 11:56:02 +02:00 committed by Henrik Brix Andersen
parent d1da07144e
commit a738bfa7f4

View file

@ -37,6 +37,7 @@ static int ipv6cp_add_iid(struct ppp_context *ctx, struct net_pkt *pkt)
if (linkaddr->len == 8) {
memcpy(iid, linkaddr->addr, iid_len);
} else {
NET_ASSERT(linkaddr->len >= 6);
memcpy(iid, linkaddr->addr, 3);
iid[3] = 0xff;
iid[4] = 0xfe;