From ba0cac09cc22c911c1c20c2947dd23f795599627 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Mon, 20 Feb 2017 17:19:06 +0100 Subject: router: fix arithmetic exception fault Signed-off-by: Hans Dedecker --- src/router.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/router.c b/src/router.c index dd3f09c..ffafb94 100644 --- a/src/router.c +++ b/src/router.c @@ -233,7 +233,8 @@ static int calc_adv_interval(struct interface *iface, uint32_t minvalid, minival = (*maxival >= 9 ? *maxival/3 : *maxival); odhcpd_urandom(&msecs, sizeof(msecs)); - msecs = (labs(msecs) % ((*maxival - minival)*1000)) + minival*1000; + msecs = (labs(msecs) % ((*maxival != minival) ? (*maxival - minival)*1000 : 500)) + + minival*1000; return msecs; } -- cgit v1.2.3