From 270ce83992bcb23b13f45e16ff670a3e23b907de Mon Sep 17 00:00:00 2001 From: Lawrence Teo Date: Wed, 14 Nov 2012 03:33:05 +0000 Subject: 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 --- usr.sbin/tcpdump/privsep_pcap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'usr.sbin/tcpdump') 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) { -- cgit v1.2.3