mirror of
https://github.com/rsmarples/dhcpcd.git
synced 2024-11-30 21:44:52 +08:00
Fix memory errors.
This commit is contained in:
parent
5979518328
commit
3270bfbf68
6
arp.c
6
arp.c
@ -57,8 +57,8 @@ send_arp(const struct interface *iface, int op, in_addr_t sip, in_addr_t tip)
|
|||||||
ar.ar_hln = iface->hwlen;
|
ar.ar_hln = iface->hwlen;
|
||||||
ar.ar_pln = sizeof(sip);
|
ar.ar_pln = sizeof(sip);
|
||||||
ar.ar_op = htons(op);
|
ar.ar_op = htons(op);
|
||||||
p = arp_buffer;
|
memcpy(arp_buffer, &ar, sizeof(ar));
|
||||||
p += sizeof(ar);
|
p = arp_buffer + sizeof(ar);
|
||||||
memcpy(p, iface->hwaddr, iface->hwlen);
|
memcpy(p, iface->hwaddr, iface->hwlen);
|
||||||
p += iface->hwlen;
|
p += iface->hwlen;
|
||||||
memcpy(p, &sip, sizeof(sip));
|
memcpy(p, &sip, sizeof(sip));
|
||||||
@ -69,7 +69,7 @@ send_arp(const struct interface *iface, int op, in_addr_t sip, in_addr_t tip)
|
|||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
memcpy(p, &tip, sizeof(tip));
|
memcpy(p, &tip, sizeof(tip));
|
||||||
p += sizeof(tip);
|
p += sizeof(tip);
|
||||||
len = sizeof(ar) + 2 * iface->hwlen + 2 * sizeof(sip);
|
len = p - arp_buffer;
|
||||||
retval = send_raw_packet(iface, ETHERTYPE_ARP, arp_buffer, len);
|
retval = send_raw_packet(iface, ETHERTYPE_ARP, arp_buffer, len);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user