diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2017-02-20 17:19:06 +0100 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2017-02-20 17:19:06 +0100 |
commit | ba0cac09cc22c911c1c20c2947dd23f795599627 (patch) | |
tree | ac872970b041786e15c1a77944f16832f968d691 | |
parent | 3495f179bd901d6d232e0dbf35444ebe483fdfd9 (diff) |
router: fix arithmetic exception fault
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r-- | src/router.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; } |