Date: Tue, 11 Mar 2008 16:39:34 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 137413 for review Message-ID: <200803111639.m2BGdYVV082870@repoman.freebsd.org>
index | next in thread | raw e-mail
http://perforce.freebsd.org/chv.cgi?CH=137413 Change 137413 by rwatson@rwatson_cinnamon on 2008/03/11 16:38:52 Don't print BPF descriptor data if we have the wrong structure size/version, as it may be garbage. Affected files ... .. //depot/projects/zcopybpf/src/usr.sbin/netstat/bpf.c#8 edit Differences ... ==== //depot/projects/zcopybpf/src/usr.sbin/netstat/bpf.c#8 (text+ko) ==== @@ -127,6 +127,10 @@ if (bpf_get_stats(&size, &bd) < 0) return; for (d = &bd[0]; d < &bd[size / sizeof(*d)]; d++) { + if (d->bd_structsize != sizeof(*d)) { + warnx("bpf_stats_extended: version mismatch"); + return; + } if (ifname && strcmp(ifname, d->bd_ifname) != 0) continue; pname = bpf_pidname(d->bd_pid); @@ -169,6 +173,10 @@ "Pid", "Netif", "Flags", "Recv", "Drop", "Match", "Sblen", "Hblen", "Command"); for (d = &bd[0]; d < &bd[size / sizeof(*d)]; d++) { + if (d->bd_structsize != sizeof(*d)) { + warnx("bpf_stats_extended: version mismatch"); + return; + } if (ifname && strcmp(ifname, d->bd_ifname) != 0) continue; bpf_flags(d, flagbuf);help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803111639.m2BGdYVV082870>
