Skip to content

Commit

Permalink
Fix timespec conversion to avoid infinite loop (#2108, @boatfish)
Browse files Browse the repository at this point in the history
Identified and proposed fix by @boatfish
  • Loading branch information
edenhill committed Nov 20, 2018
1 parent 81d32d5 commit 53429d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rdtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static RD_INLINE void rd_timeout_init_timespec (struct timespec *tspec,
timespec_get(tspec, TIME_UTC);
tspec->tv_sec += timeout_ms / 1000;
tspec->tv_nsec += (timeout_ms % 1000) * 1000000;
if (tspec->tv_nsec > 1000000000) {
if (tspec->tv_nsec >= 1000000000) {
tspec->tv_nsec -= 1000000000;
tspec->tv_sec++;
}
Expand Down

0 comments on commit 53429d3

Please sign in to comment.