From 18d7539d2e2ac1712b6f083ff93f1422b748266d Mon Sep 17 00:00:00 2001 From: msmith Date: Mon, 28 May 2001 22:27:06 +0000 Subject: Correct the returned UDP datagram length. See the PR for a more comprehensive description of the fix. PR: misc/25503 Submitted by: Jim Browne MFC after: 1 week --- lib/libstand/udp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') 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); } -- cgit v1.1