]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
time: fix various time issues
authorVictor Julien <vjulien@oisf.net>
Tue, 24 Jan 2023 19:29:52 +0000 (20:29 +0100)
committerVictor Julien <vjulien@oisf.net>
Tue, 24 Jan 2023 19:29:55 +0000 (20:29 +0100)
Found by Coverity Scan.

src/flow-timeout.c
src/source-nflog.c
src/stream-tcp.c

index 5063e2ab7ce2bca897849cb718780dc39cec6092..b6f41364638f912f3aa2f87d4ecff5d81ed4ada4 100644 (file)
@@ -247,7 +247,6 @@ static inline Packet *FlowForceReassemblyPseudoPacketSetup(Packet *p,
                                               (uint16_t *)p->tcph, 20, 0);
     }
 
-    memset(&p->ts, 0, sizeof(struct timeval));
     p->ts = TimeGet();
 
     if (direction == 0) {
index 2d45bf15abe69e8ce6b825f285660dad0ab64a12..b2129b54f5a104e3bdf9fd11a238350a5bf99a44 100644 (file)
@@ -180,8 +180,10 @@ static int NFLOGCallback(struct nflog_g_handle *gh, struct nfgenmsg *msg,
 
     ret = nflog_get_timestamp(nfa, &p->ts);
     if (ret != 0) {
-        memset(&p->ts, 0, sizeof(struct timeval));
-        gettimeofday(&p->ts, NULL);
+        struct timeval tv;
+        memset(&tv, 0, sizeof(struct timeval));
+        gettimeofday(&tv, NULL);
+        p->ts = SCTIME_FROM_TIMEVAL(&tv);
     }
 
     p->datalink = DLT_RAW;
index bcc025809a1faf9fc19903019329875bf2305396..82dac90a4bf928c324d9b1e6701f203a9d14b2e7 100644 (file)
@@ -6381,7 +6381,7 @@ static void StreamTcpPseudoPacketCreateDetectLogFlush(ThreadVars *tv,
     }
 
     /* use parent time stamp */
-    memcpy(&np->ts, &parent->ts, sizeof(struct timeval));
+    np->ts = parent->ts;
 
     SCLogDebug("np %p", np);
     PacketEnqueueNoLock(pq, np);