From: Victor Julien Date: Tue, 24 Jan 2023 19:29:52 +0000 (+0100) Subject: time: fix various time issues X-Git-Tag: suricata-7.0.0-rc1~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=420351eda265ec11ca503683765a0db120dc195f;p=thirdparty%2Fsuricata.git time: fix various time issues Found by Coverity Scan. --- diff --git a/src/flow-timeout.c b/src/flow-timeout.c index 5063e2ab7c..b6f4136463 100644 --- a/src/flow-timeout.c +++ b/src/flow-timeout.c @@ -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) { diff --git a/src/source-nflog.c b/src/source-nflog.c index 2d45bf15ab..b2129b54f5 100644 --- a/src/source-nflog.c +++ b/src/source-nflog.c @@ -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; diff --git a/src/stream-tcp.c b/src/stream-tcp.c index bcc025809a..82dac90a4b 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -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);