]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/tag: improve time handling on windows
authorVictor Julien <vjulien@oisf.net>
Tue, 18 Oct 2022 12:08:02 +0000 (14:08 +0200)
committerVictor Julien <vjulien@oisf.net>
Wed, 19 Oct 2022 21:03:24 +0000 (23:03 +0200)
Bug: #5584.

src/detect-engine-tag.c

index d445560f3914b9db73e6b3b5d2d12864d48a3d4e..61cada65474b7574c0a59d65c3377c5039e36a49 100644 (file)
@@ -555,7 +555,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;