2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

tv_nsec can never be negative after timespecsub.

Found by PVS Studio
This commit is contained in:
Todd C. Miller
2018-10-17 06:21:48 -06:00
parent 25a58ba1ca
commit 939585e906
3 changed files with 3 additions and 3 deletions

View File

@@ -787,7 +787,7 @@ sudo_ev_get_timeleft_v2(struct sudo_event *ev, struct timespec *ts)
sudo_gettime_mono(&now);
sudo_timespecsub(&ev->timeout, &now, ts);
if (ts->tv_sec < 0 || (ts->tv_sec == 0 && ts->tv_nsec < 0))
if (ts->tv_sec < 0)
sudo_timespecclear(ts);
debug_return_int(0);
}