freebsd_network: Use user_memcpy() for ETHER_ADDMULTI/ETHER_REMMULTI

Change-Id: Id0a7e50f9ae38bff42faf1d6c4a62f702347bda3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3446
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Jérôme Duval 2020-11-30 19:36:12 +01:00 committed by Adrien Destugues
parent a1c9aa9d90
commit b943b993c7

View File

@ -244,10 +244,13 @@ compat_control(void *cookie, uint32 op, void *arg, size_t length)
if ((ifp->if_flags & IFF_MULTICAST) == 0)
return B_NOT_SUPPORTED;
if (length != ETHER_ADDR_LEN)
return B_BAD_VALUE;
memset(&address, 0, sizeof(address));
address.sdl_family = AF_LINK;
memcpy(LLADDR(&address), arg, ETHER_ADDR_LEN);
if (user_memcpy(LLADDR(&address), arg, ETHER_ADDR_LEN) < B_OK)
return B_BAD_ADDRESS;
if (op == ETHER_ADDMULTI)
return if_addmulti(ifp, (struct sockaddr *)&address, NULL);