main: fix ip address copy length in send_arp_request
authorFelix Fietkau <nbd@openwrt.org>
Thu, 29 Oct 2015 14:25:03 +0000 (15:25 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 29 Oct 2015 14:28:31 +0000 (15:28 +0100)
Detected by Coverity CID 133115313311521331125

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
main.c

diff --git a/main.c b/main.c
index 7f33d90adb38291e12bdafc24b3ed8e043b6788b..bd330ee0581be961588e4336ca1a893835776690 100644 (file)
--- a/main.c
+++ b/main.c
@@ -165,7 +165,7 @@ static void send_arp_request(struct relayd_interface *rif, const uint8_t *ipaddr
        fill_arp_packet(&pkt, rif, rif->src_ip, ipaddr);
 
        pkt.arp.arp_op = htons(ARPOP_REQUEST);
-       memcpy(pkt.arp.arp_spa, rif->src_ip, ETH_ALEN);
+       memcpy(pkt.arp.arp_spa, rif->src_ip, sizeof(pkt.arp.arp_spa));
        memset(pkt.arp.arp_tha, 0, ETH_ALEN);
        memset(pkt.eth.ether_dhost, 0xff, ETH_ALEN);