libnl icon indicating copy to clipboard operation
libnl copied to clipboard

lib: adjust small time values in _badrandom_from_time

Open cferris1000 opened this issue 7 months ago • 1 comments

On some systems, the clock is reset, or is lost, so the value returned by time can be a very small value. In that case, the _badrandom_from_time function returns a large value close to the maximum uint32_t value. This can be a problem when used to create a sequence number and that number overflows the uint32_t maximum value when it is incremented.

In this case, detect when the time value is too small, and add a value to make sure the value returned is not too close to the uint32_t maximum value.

cferris1000 avatar Jul 10 '24 22:07 cferris1000