diff options
author | Steven Barth <steven@midlink.org> | 2013-05-28 20:47:33 +0200 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2013-05-28 20:47:33 +0200 |
commit | b19c14ca2ea5594d37bd3492ad147047eed4703f (patch) | |
tree | 00f5843eccf3176d2f0cce0bb68910cc1c8c6084 /system-linux.c | |
parent | eec42f59364590f2210849a3a48ceb3ee8cbbb1c (diff) |
IPv6: fix address-lifetime overflows on 64-bit architectures
Diffstat (limited to 'system-linux.c')
-rw-r--r-- | system-linux.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/system-linux.c b/system-linux.c index f5c900d..c6d81e6 100644 --- a/system-linux.c +++ b/system-linux.c @@ -918,17 +918,21 @@ static int system_addr(struct device *dev, struct device_addr *addr, int cmd) struct ifa_cacheinfo cinfo = {0xffffffffU, 0xffffffffU, 0, 0}; if (addr->preferred_until) { - int preferred = addr->preferred_until - now; + int64_t preferred = addr->preferred_until - now; if (preferred < 0) preferred = 0; + else if (preferred > UINT32_MAX) + preferred = UINT32_MAX; cinfo.ifa_prefered = preferred; } if (addr->valid_until) { - int valid = addr->valid_until - now; + int64_t valid = addr->valid_until - now; if (valid <= 0) return -1; + else if (valid > UINT32_MAX) + valid = UINT32_MAX; cinfo.ifa_valid = valid; } |