summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2017-12-27 03:18:13 +0000
committeremaste <emaste@FreeBSD.org>2017-12-27 03:18:13 +0000
commit62e88dd9c6a8ea4d5a5b24f071e08767e256c571 (patch)
tree5ac11f62c40c93d290bb87fe577c8ffed4acd2aa
parent02ee52a1adfddbb5a3aa7cd7b6ce6ae98a82bac4 (diff)
downloadFreeBSD-src-62e88dd9c6a8ea4d5a5b24f071e08767e256c571.zip
FreeBSD-src-62e88dd9c6a8ea4d5a5b24f071e08767e256c571.tar.gz
MFC r317409 by glebius:
Cherry-pick 5d3c5151c2b885aab36627bafb8539238da27b2d, it fixes use after free if tcpdump(1) is run on non-existent interface.
-rw-r--r--contrib/tcpdump/tcpdump.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/tcpdump/tcpdump.c b/contrib/tcpdump/tcpdump.c
index 202dce2..527f39d 100644
--- a/contrib/tcpdump/tcpdump.c
+++ b/contrib/tcpdump/tcpdump.c
@@ -1085,9 +1085,9 @@ open_interface(const char *device, netdissect_options *ndo, char *ebuf)
/*
* Return an error for our caller to handle.
*/
- pcap_close(pc);
snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s: %s\n(%s)",
device, pcap_statustostr(status), cp);
+ pcap_close(pc);
return (NULL);
} else if (status == PCAP_ERROR_PERM_DENIED && *cp != '\0')
error("%s: %s\n(%s)", device,
OpenPOWER on IntegriCloud