odhcp6c: fix integer overflow after 50 days
[openwrt/svn-archive/archive.git] / package / odhcp6c / patches / 001-fix-integer-overflow-after-50-days.patch
1 From 5b98f902f616bd9b96a2128587bc6995555a43c1 Mon Sep 17 00:00:00 2001
2 From: Steven Barth <steven@midlink.org>
3 Date: Fri, 7 Mar 2014 10:33:49 +0100
4 Subject: [PATCH] fix integer overflow after 50 days (thx Hauke Mehrtens)
5
6 ---
7 src/odhcp6c.c | 2 +-
8 1 file changed, 1 insertion(+), 1 deletion(-)
9
10 diff --git a/src/odhcp6c.c b/src/odhcp6c.c
11 index 3c6b3b0..ba11ced 100644
12 --- a/src/odhcp6c.c
13 +++ b/src/odhcp6c.c
14 @@ -470,7 +470,7 @@ uint64_t odhcp6c_get_milli_time(void)
15 {
16 struct timespec t = {0, 0};
17 syscall(SYS_clock_gettime, CLOCK_MONOTONIC, &t);
18 - return t.tv_sec * 1000 + t.tv_nsec / 1000000;
19 + return ((uint64_t)t.tv_sec) * 1000 + ((uint64_t)t.tv_nsec) / 1000000;
20 }
21
22
23 --
24 1.7.10.4
25