diff options
author | 2017-04-18 13:59:09 +0000 | |
---|---|---|
committer | 2017-04-18 13:59:09 +0000 | |
commit | 6c731dee736c1100b3d6ed614f8be740f786c335 (patch) | |
tree | 86e6fb7c533e74ef0065e735c07dadf62323ce75 /sbin/dhclient/bpf.c | |
parent | Fix previous: i forgot explicit NUL termination; (diff) | |
download | wireguard-openbsd-6c731dee736c1100b3d6ed614f8be740f786c335.tar.xz wireguard-openbsd-6c731dee736c1100b3d6ed614f8be740f786c335.zip |
Tweak parameters to decode_*, add a check or two, and thus gain most of the
sanity improvements reyk@ recently put into dhcrelay to ensure no more than
the captured packet is processed.
Diffstat (limited to 'sbin/dhclient/bpf.c')
-rw-r--r-- | sbin/dhclient/bpf.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c index 03a56e8a444..2e6978c48b8 100644 --- a/sbin/dhclient/bpf.c +++ b/sbin/dhclient/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.48 2017/04/18 13:44:03 krw Exp $ */ +/* $OpenBSD: bpf.c,v 1.49 2017/04/18 13:59:09 krw Exp $ */ /* BPF socket interface code, originally contributed by Archie Cobbs. */ @@ -397,7 +397,8 @@ receive_packet(struct interface_info *ifi, struct sockaddr_in *from, ifi->rbuf_offset += hdr.bh_hdrlen; /* Decode the physical header. */ - offset = decode_hw_header(ifi->rbuf, ifi->rbuf_offset, hfrom); + offset = decode_hw_header(ifi->rbuf + ifi->rbuf_offset, + hdr.bh_caplen, hfrom); /* * If a physical layer checksum failed (dunno of any @@ -413,8 +414,8 @@ receive_packet(struct interface_info *ifi, struct sockaddr_in *from, hdr.bh_caplen -= offset; /* Decode the IP and UDP headers. */ - offset = decode_udp_ip_header(ifi->rbuf, - ifi->rbuf_offset, from, hdr.bh_caplen); + offset = decode_udp_ip_header(ifi->rbuf + ifi->rbuf_offset, + hdr.bh_caplen, from); /* If the IP or UDP checksum was bad, skip the packet. */ if (offset < 0) { |