diff options
-rw-r--r-- | lib/libstand/udp.c | 3 |
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); } |