diff options
author | Richard Genoud <richard.genoud@gmail.com> | 2014-09-17 21:17:39 +0100 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2014-09-17 21:17:39 +0100 |
commit | 10cfc0ddb35d8e7d19bdb86240a49004980b1ff8 (patch) | |
tree | 15d1b4bf31d09b19ee07f0d7f6a8912f7486db5c /src/netlink.c | |
parent | 15b1b7e9c330c2a746718c288550960450c01863 (diff) | |
download | dnsmasq-10cfc0ddb35d8e7d19bdb86240a49004980b1ff8.tar.gz |
Fix length->netmask conversions to avoid undefined behaviour.
Diffstat (limited to 'src/netlink.c')
-rw-r--r-- | src/netlink.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/netlink.c b/src/netlink.c index cff43cc..b393283 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -208,7 +208,8 @@ int iface_enumerate(int family, void *parm, int (*callback)()) struct in_addr netmask, addr, broadcast; char *label = NULL; - netmask.s_addr = htonl(0xffffffff << (32 - ifa->ifa_prefixlen)); + netmask.s_addr = htonl(~(in_addr_t)0 << (32 - ifa->ifa_prefixlen)); + addr.s_addr = 0; broadcast.s_addr = 0; |