]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
pfring: Packet structure for ts fix
authorJeff Lucovsky <jlucovsky@oisf.net>
Fri, 17 Feb 2023 14:18:24 +0000 (09:18 -0500)
committerVictor Julien <vjulien@oisf.net>
Mon, 6 Mar 2023 07:23:14 +0000 (08:23 +0100)
Issue: 5818

This commit addresses the issue with using the address of a packed
member of a structure. The pfring timeval is within a packed structure.

src/source-pfring.c

index 61423e2232798c539a6ea98342bec97d067234fa..991197491146bd48f9f6f5970f07096600b05e32 100644 (file)
@@ -231,7 +231,9 @@ static inline void PfringProcessPacket(void *user, struct pfring_pkthdr *h, Pack
 
     /* PF_RING may fail to set timestamp */
     if (h->ts.tv_sec == 0) {
-        gettimeofday((struct timeval *)&h->ts, NULL);
+        struct timeval tmp_ts;
+        gettimeofday(&tmp_ts, NULL);
+        h->ts = tmp_ts;
     }
 
     p->ts = SCTIME_FROM_TIMEVAL(&h->ts);