Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Apr 2017 15:56:46 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r317409 - head/contrib/tcpdump
Message-ID:  <201704251556.v3PFuk5U053547@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704251556.v3PFuk5U053547>