From b8e7eef5304fc7c6cec220c2db9e4eedad2d5043 Mon Sep 17 00:00:00 2001 From: lteo Date: Fri, 16 Jan 2015 03:04:19 +0000 Subject: [PATCH] Fix a use after free, where the already freed p->opt.source was used by pcap_cleanup_bpf() to disable monitor mode on 802.11 devices. feedback blambert@ ok deraadt@ mikeb@ millert@ --- lib/libpcap/pcap-bpf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/libpcap/pcap-bpf.c b/lib/libpcap/pcap-bpf.c index 12a7130e3aa..5ca44688c13 100644 --- a/lib/libpcap/pcap-bpf.c +++ b/lib/libpcap/pcap-bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcap-bpf.c,v 1.24 2014/10/16 20:08:21 deraadt Exp $ */ +/* $OpenBSD: pcap-bpf.c,v 1.25 2015/01/16 03:04:19 lteo Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996, 1998 @@ -431,9 +431,8 @@ pcap_cleanup_bpf(pcap_t *p) void pcap_close(pcap_t *p) { - if (p->opt.source != NULL) - free(p->opt.source); pcap_cleanup_bpf(p); + free(p->opt.source); free(p); } -- 2.20.1