diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-02-02 21:32:28 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-02-02 21:34:35 -0500 |
commit | 6cb8e687f038424ef54b5c5c3c433be974fbe371 (patch) | |
tree | b905dd98bb19544edd2e2e3085a3820e4e33d29c /src/network/networkd-address.c | |
parent | c1d630d5fd3c0b3307811d51f9840652e066a0f2 (diff) |
network-address,test-network: avoid undefined behaviour
Diffstat (limited to 'src/network/networkd-address.c')
-rw-r--r-- | src/network/networkd-address.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index ce0e923cbe..47033acde4 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -592,6 +592,10 @@ bool address_equal(Address *a1, Address *a2) { case AF_INET: if (a1->prefixlen != a2->prefixlen) return false; + else if (a1->prefixlen == 0) + /* make sure we don't try to shift by 32. + * See ISO/IEC 9899:TC3 § 6.5.7.3. */ + return true; else { uint32_t b1, b2; |