From: Victor Julien Date: Tue, 18 Oct 2022 12:08:02 +0000 (+0200) Subject: detect/tag: improve time handling on windows X-Git-Tag: suricata-6.0.9~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5bc56cecb10e9d0f6ca850e5c4afa8da04bf590;p=thirdparty%2Fsuricata.git detect/tag: improve time handling on windows Bug: #5584. (cherry picked from commit 0977f40d1cf6d5dad75c95f31614678225a77943) --- diff --git a/src/detect-engine-tag.c b/src/detect-engine-tag.c index f79548eb61..505ff443fd 100644 --- a/src/detect-engine-tag.c +++ b/src/detect-engine-tag.c @@ -553,7 +553,9 @@ int TagTimeoutCheck(Host *host, struct timeval *tv) prev = NULL; while (tmp != NULL) { - if ((tv->tv_sec - tmp->last_ts) <= TAG_MAX_LAST_TIME_SEEN) { + struct timeval last_ts = { .tv_sec = tmp->last_ts, 0 }; + struct timeval timeout_at = TimevalWithSeconds(&last_ts, TAG_MAX_LAST_TIME_SEEN); + if (!TimevalEarlier(&timeout_at, tv)) { prev = tmp; tmp = tmp->next; retval = 0;