diff options
author | Lawrence Teo <lteo@cvs.openbsd.org> | 2012-11-14 03:33:05 +0000 |
---|---|---|
committer | Lawrence Teo <lteo@cvs.openbsd.org> | 2012-11-14 03:33:05 +0000 |
commit | 270ce83992bcb23b13f45e16ff670a3e23b907de (patch) | |
tree | efcc5e4070e4b4dba40bfefd71af91b83b53691d /usr.sbin/tcpdump | |
parent | 4982a4fad195f90c9844268f6d97dee3ec11aef2 (diff) |
In the unlikely event that a NULL device is passed to priv_pcap_live(),
ensure that the function will stop and return NULL instead of continuing
(which could lead to a segfault).
ok benno deraadt otto
Diffstat (limited to 'usr.sbin/tcpdump')
-rw-r--r-- | usr.sbin/tcpdump/privsep_pcap.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/tcpdump/privsep_pcap.c b/usr.sbin/tcpdump/privsep_pcap.c index 0025fbc1903..032df06e12c 100644 --- a/usr.sbin/tcpdump/privsep_pcap.c +++ b/usr.sbin/tcpdump/privsep_pcap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep_pcap.c,v 1.16 2010/09/21 04:08:12 henning Exp $ */ +/* $OpenBSD: privsep_pcap.c,v 1.17 2012/11/14 03:33:04 lteo Exp $ */ /* * Copyright (c) 2004 Can Erkin Acar @@ -234,8 +234,10 @@ priv_pcap_live(const char *dev, int slen, int prom, int to_ms, if (priv_fd < 0) errx(1, "%s: called from privileged portion", __func__); - if (dev == NULL) + if (dev == NULL) { snprintf(ebuf, PCAP_ERRBUF_SIZE, "No interface specified"); + return (NULL); + } p = (pcap_t *)malloc(sizeof(*p)); if (p == NULL) { |