Skip to content
Snippets Groups Projects
Commit 1f4d57d6 authored by Martine Lenders's avatar Martine Lenders
Browse files

gnrc_ipv6_nib/arsm: ensure proper int width in backoff calculation

Otherwise, the result might flow over on 8/16-bit platforms
parent 98f42eee
No related branches found
No related tags found
No related merge requests found
......@@ -519,7 +519,8 @@ static inline uint32_t _exp_backoff_retrans_timer(uint8_t ns_sent,
/* backoff according to https://tools.ietf.org/html/rfc7048 with
* BACKOFF_MULTIPLE == 2 */
tmp = ((1 << ns_sent) * retrans_timer * tmp) / US_PER_MS;
tmp = (uint32_t)(((uint64_t)(((uint32_t) 1) << ns_sent) * retrans_timer *
tmp) / US_PER_MS);
/* random factors were statically multiplied with 1000 ^ */
if (tmp > NDP_MAX_RETRANS_TIMER_MS) {
tmp = NDP_MAX_RETRANS_TIMER_MS;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment