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
This commit is contained in:
parent
af92de5eeb
commit
bbedc40bf2
1 changed files with 1 additions and 1 deletions
2
arp.c
2
arp.c
|
|
@ -55,7 +55,7 @@ void sendarp(int ifr_idx, const unsigned char* mac, in_addr_t ip)
|
||||||
|
|
||||||
memset(&sll, 0, sizeof(sll));
|
memset(&sll, 0, sizeof(sll));
|
||||||
sll.sll_family = AF_PACKET;
|
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_halen = ETH_ALEN;
|
||||||
sll.sll_ifindex = ifr_idx;
|
sll.sll_ifindex = ifr_idx;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue