From bbedc40bf24f51e01c3fe9e35983744db9181ae2 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Sat, 5 Nov 2022 21:25:31 +0900 Subject: [PATCH] sendarp: fix out of bound read on mac address mac address is only 6 bytes, which we specify in sll_halen, so do not try to read more than that into sll_addr. Reported-by: Coverity#375313 --- arp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arp.c b/arp.c index 0aae069..2b4c664 100644 --- a/arp.c +++ b/arp.c @@ -55,7 +55,7 @@ void sendarp(int ifr_idx, const unsigned char* mac, in_addr_t ip) memset(&sll, 0, sizeof(sll)); sll.sll_family = AF_PACKET; - memcpy(sll.sll_addr, mac, sizeof(sll.sll_addr) - 1); + memcpy(sll.sll_addr, mac, ETH_ALEN); sll.sll_halen = ETH_ALEN; sll.sll_ifindex = ifr_idx;