lib: avoid overflow in computation of s_seq_next
On some systems, the clock is reset, or is lost, so the value returned
by the time function can be a very small value. In that case, the
_badrandom_from_time function returns a large value close to the
maximum unsigned int value for s_seq_next. This can lead to the value
wrapping around fairly quickly.
When compiling the library with the unsigned-integer-overflow sanitizer
enabled, this causes an abort.
Detect this potential wrap around condition and avoid it.
https://github.com/thom311/libnl/pull/395
2 files changed