[haiku-commits] Change in haiku[master]: freebsd_network: Use user_memcpy() for ETHER_ADDMULTI/ETHER_REMMULTI

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 1 Dec 2020 20:21:35 +0000

From Jérôme Duval <jerome.duval@xxxxxxxxx>:

Jérôme Duval has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/3446 ;)


Change subject: freebsd_network: Use user_memcpy() for 
ETHER_ADDMULTI/ETHER_REMMULTI
......................................................................

freebsd_network: Use user_memcpy() for ETHER_ADDMULTI/ETHER_REMMULTI
---
M src/libs/compat/freebsd_network/device_hooks.c
1 file changed, 4 insertions(+), 1 deletion(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/46/3446/1

diff --git a/src/libs/compat/freebsd_network/device_hooks.c 
b/src/libs/compat/freebsd_network/device_hooks.c
index 565f2db..7a5331d 100644
--- a/src/libs/compat/freebsd_network/device_hooks.c
+++ b/src/libs/compat/freebsd_network/device_hooks.c
@@ -244,10 +244,13 @@

                        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);

--
To view, visit https://review.haiku-os.org/c/haiku/+/3446
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Id0a7e50f9ae38bff42faf1d6c4a62f702347bda3
Gerrit-Change-Number: 3446
Gerrit-PatchSet: 1
Gerrit-Owner: Jérôme Duval <jerome.duval@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: freebsd_network: Use user_memcpy() for ETHER_ADDMULTI/ETHER_REMMULTI - Gerrit