summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2001-05-28 22:27:06 +0000
committermsmith <msmith@FreeBSD.org>2001-05-28 22:27:06 +0000
commit18d7539d2e2ac1712b6f083ff93f1422b748266d (patch)
tree1edb848e85238ab847f0af08f6b32ff586bbeb73 /lib
parent10ff37925c1593f4942260b7ac6e45407d146cfc (diff)
downloadFreeBSD-src-18d7539d2e2ac1712b6f083ff93f1422b748266d.zip
FreeBSD-src-18d7539d2e2ac1712b6f083ff93f1422b748266d.tar.gz
Correct the returned UDP datagram length. See the PR for a more comprehensive
description of the fix. PR: misc/25503 Submitted by: Jim Browne <jbrowne@jbrowne.com> MFC after: 1 week
Diffstat (limited to 'lib')
-rw-r--r--lib/libstand/udp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libstand/udp.c b/lib/libstand/udp.c
index e5992ef..ffb0f70 100644
--- a/lib/libstand/udp.c
+++ b/lib/libstand/udp.c
@@ -267,6 +267,7 @@ readudp(d, pkt, len, tleft)
return -1;
}
- n -= sizeof(*ip) + sizeof(*uh);
+ n = (n > (ntohs(uh->uh_ulen) - sizeof(*uh))) ?
+ ntohs(uh->uh_ulen) - sizeof(*uh) : n;
return (n);
}
OpenPOWER on IntegriCloud