Cherry-pick 5d3c5151c2b885aab36627bafb8539238da27b2d, it fixes use after free

if tcpdump(1) is run on non-existent interface.

Suggested by:	zeising
This commit is contained in:
Gleb Smirnoff 2017-04-25 15:56:46 +00:00
parent 11bc2c1ca7
commit f97074045b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=317409

View file

@ -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,