Calling gettimeofday on a struct bpf_timeval is harmful

This commit is contained in:
jca 2019-03-04 13:25:56 +00:00
parent 7df041638d
commit f7ef33bc4b
2 changed files with 21 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.15 2019/03/04 13:01:53 jca Exp $
# $OpenBSD: Makefile,v 1.16 2019/03/04 13:25:56 jca Exp $
COMMENT= cisco 3600/7200 platform emulator
@ -6,7 +6,7 @@ USE_WXNEEDED= Yes
DISTNAME= dynamips-0.2.8-RC2
PKGNAME= ${DISTNAME:S/-RC/rc/}
REVISION= 8
REVISION= 9
CATEGORIES= emulators
HOMEPAGE= http://www.gns3.net/dynamips/

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-net_io_filter_c,v 1.1 2019/03/04 13:25:56 jca Exp $
Index: net_io_filter.c
--- net_io_filter.c.orig
+++ net_io_filter.c
@@ -211,9 +211,12 @@ static int pf_capture_pkt_handler(netio_desc_t *nio,vo
{
struct netio_filter_capture *c = opt;
struct pcap_pkthdr pkt_hdr;
+ struct timeval tv;
if (c != NULL) {
- gettimeofday(&pkt_hdr.ts,0);
+ gettimeofday(&tv,0);
+ pkt_hdr.ts.tv_sec = tv.tv_sec;
+ pkt_hdr.ts.tv_usec = tv.tv_usec;
pkt_hdr.caplen = len;
pkt_hdr.len = len;