From: Hans Dedecker Date: Mon, 20 Feb 2017 16:19:06 +0000 (+0100) Subject: router: fix arithmetic exception fault X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ba0cac09cc22c911c1c20c2947dd23f795599627;p=oweals%2Fodhcpd.git router: fix arithmetic exception fault Signed-off-by: Hans Dedecker --- 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; }