Commit b165a191 authored by Antonin Décimo's avatar Antonin Décimo Committed by Juliusz Chroboczek

Prevent undefined behaviour when right-shifting of too much bits.

parent 1dfc5f67
......@@ -171,9 +171,11 @@ update_neighbour(struct neighbour *neigh, struct hello_history *hist,
}
if(missed_hellos > 0) {
if((unsigned)missed_hellos >= sizeof(hist->reach) * 8)
hist->reach = 0;
else
hist->reach >>= missed_hellos;
hist->seqno = seqno_plus(hist->seqno, missed_hellos);
missed_hellos = 0;
rc = 1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment