svn commit: r317409 - head/contrib/tcpdump

Gleb Smirnoff glebius at FreeBSD.org
Tue Apr 25 15:56:48 UTC 2017


Author: glebius
Date: Tue Apr 25 15:56:46 2017
New Revision: 317409
URL: https://svnweb.freebsd.org/changeset/base/317409

Log:
  Cherry-pick 5d3c5151c2b885aab36627bafb8539238da27b2d, it fixes use after free
  if tcpdump(1) is run on non-existent interface.
  
  Suggested by:	zeising

Modified:
  head/contrib/tcpdump/tcpdump.c

Modified: head/contrib/tcpdump/tcpdump.c
==============================================================================
--- head/contrib/tcpdump/tcpdump.c	Tue Apr 25 13:17:34 2017	(r317408)
+++ head/contrib/tcpdump/tcpdump.c	Tue Apr 25 15:56:46 2017	(r317409)
@@ -1085,9 +1085,9 @@ open_interface(const char *device, netdi
 			/*
 			 * 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,


More information about the svn-src-all mailing list