arp-util: check ifindex and mac address

This commit is contained in:
Yu Watanabe
2021-07-01 00:49:02 +09:00
parent f6720fe62e
commit 504bf2b54a
+3
View File
@@ -8,6 +8,7 @@
#include <netinet/if_ether.h>
#include "arp-util.h"
#include "ether-addr-util.h"
#include "fd-util.h"
#include "unaligned.h"
#include "util.h"
@@ -115,8 +116,10 @@ static int arp_send_packet(
ssize_t n;
assert(fd >= 0);
assert(ifindex > 0);
assert(pa != 0);
assert(ha);
assert(!ether_addr_is_null(ha));
memcpy(&arp.arp_sha, ha, ETH_ALEN);
memcpy(&arp.arp_tpa, &pa, sizeof(pa));