summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/ipdb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/accel-pppd/ipdb.c b/accel-pppd/ipdb.c
index dd8c61c9..8fc08063 100644
--- a/accel-pppd/ipdb.c
+++ b/accel-pppd/ipdb.c
@@ -83,7 +83,10 @@ void __export build_ip6_addr(struct ipv6db_addr_t *a, uint64_t intf_id, struct i
if (a->prefix_len <= 64)
*(uint64_t *)(addr->s6_addr + 8) = intf_id;
else
- *(uint64_t *)(addr->s6_addr + 8) |= intf_id & htobe64((1 << (128 - a->prefix_len)) - 1);
+ /* prefix_len 65..127 means a shift of up to 63 bits: a plain
+ * int literal 1 is undefined behavior for shifts >= 31, so the
+ * host bits mask must be built from a 64-bit constant */
+ *(uint64_t *)(addr->s6_addr + 8) |= intf_id & htobe64((UINT64_C(1) << (128 - a->prefix_len)) - 1);
}