dhcpcd-3.1.5
+Fix the flushing of addresses on BSD systems.
Rework the arp code again so that we don't link to librt on Linux.
Thanks to regenrecht for reporting the below three overflows:-
Fix a potential buffer overflow in hwaddr_ntoa if length > 42.
}
for (p = ifc.ifc_buf; p < ifc.ifc_buf + ifc.ifc_len;) {
- struct ifreq *ifr = (struct ifreq *) p;
+ union {
+ char *buffer;
+ struct ifreq *ifr;
+ } ifreqs;
struct sockaddr_in address;
+ struct ifreq *ifr;
+
+ /* Cast the ifc buffer to an ifreq cleanly */
+ ifreqs.buffer = p;
+ ifr = ifreqs.ifr;
#ifdef __linux__
p += sizeof (struct ifreq);
int flush_addresses (const char *ifname)
{
- struct in_addr address;
- unsigned char buf[1024];
- int len = 0;
-
- memset (buf, 0, 1023);
- return (_do_interface (ifname, buf, &len, &address, true, false));
+ return (_do_interface (ifname, NULL, NULL, NULL, true, false));
}
unsigned long get_address (const char *ifname)