aboutsummaryrefslogtreecommitdiff
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2006-09-26 01:02:02 +0000
committerBrooks Davis <brooks@FreeBSD.org>2006-09-26 01:02:02 +0000
commitebe609b4a27915450777936bd6b50e685531a647 (patch)
tree8cc77d01c18a1ee953f94c1fc1973ef6724c4194 /sbin/dhclient
parent88b85279a901523fc7048185563f8ab97418303a (diff)
downloadsrc-ebe609b4a27915450777936bd6b50e685531a647.tar.gz
src-ebe609b4a27915450777936bd6b50e685531a647.zip
It is possible for bpf to return a length such that:
length != BPF_WORDALIGN(length) This meeans that it is possible for this to be true: interface->rbuf_offset > interface->rbuf_len Handle this case in the test for running out of packets. While OpenBSD's solution of setting interface->rbuf_len to BPF_WORDALIGN(length) is safe due to the size of the buffer, I think this solution results in less hidden assumptions. This should fix the problem of dhclient running away and consuming 100% CPU. PR: bin/102226 Submitted by: Joost Bekkers <joost at jodocus.org> MFC after: 3 days
Notes
Notes: svn path=/head/; revision=162641
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/bpf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sbin/dhclient/bpf.c b/sbin/dhclient/bpf.c
index 785db2195a77..43122fb8972b 100644
--- a/sbin/dhclient/bpf.c
+++ b/sbin/dhclient/bpf.c
@@ -282,7 +282,7 @@ receive_packet(struct interface_info *interface, unsigned char *buf,
*/
do {
/* If the buffer is empty, fill it. */
- if (interface->rbuf_offset == interface->rbuf_len) {
+ if (interface->rbuf_offset >= interface->rbuf_len) {
length = read(interface->rfdesc, interface->rbuf,
interface->rbuf_max);
if (length <= 0)