| Summary: | possible null pointer deref in bpfdetach() | ||
|---|---|---|---|
| Product: | Base System | Reporter: | cc <cc> |
| Component: | kern | Assignee: | Matthew N. Dodd <mdodd> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 5.0-CURRENT | ||
| Hardware: | Any | ||
| OS: | Any | ||
State Changed From-To: open->closed Responsible Changed From-To: freebsd-bugs->mdodd Comitted. |
in net/bpf.c, bpfdetach(), stuct bpf_if *bp is used in a for loop, that, if not terminated by break before, leaves bp == NULL. evaluating (bp->bif_ifp == NULL) two lines later will cause a NULL pointer dereference, resulting in trap 12. Fix: RCS file: /usr/cvs/src/sys/net/bpf.c,v retrieving revision 1.80 diff -r1.80 bpf.c 1267c1267 < if (bp->bif_ifp == NULL) { --- > if (bp == NULL || bp->bif_ifp == NULL) { How-To-Repeat: just call bpfdetach(ifp) with any ifp that has no bpf interface attached.