--- lib/libc/net/gethostbydns.c 16 Feb 2000 04:39:00 -0000 1.27 +++ lib/libc/net/gethostbydns.c 26 Jun 2002 06:24:29 -0000 1.27.2.2 @@ -389,6 +389,7 @@ buflen -= nn; } + buflen -= sizeof(align) - ((u_long)bp % sizeof(align)); bp += sizeof(align) - ((u_long)bp % sizeof(align)); if (bp + n >= &hostbuf[sizeof hostbuf]) { --- lib/libc/net/getnetbydns.c 5 Mar 2001 10:47:08 -0000 1.13.2.1 +++ lib/libc/net/getnetbydns.c 26 Jun 2002 06:34:18 -0000 1.13.2.2 @@ -173,7 +173,9 @@ } cp += n; *ap++ = bp; - bp += strlen(bp) + 1; + n = strlen(bp) + 1; + bp += n; + buflen -= n; net_entry.n_addrtype = (class == C_IN) ? AF_INET : AF_UNSPEC; haveanswer++; --- lib/libc/net/name6.c 19 Jul 2000 06:22:01 -0000 1.6.2.5 +++ lib/libc/net/name6.c 26 Jun 2002 06:06:43 -0000 1.6.2.6 @@ -1024,7 +1024,7 @@ register const u_char *cp; register int n; const u_char *eom, *erdata; - char *bp, **ap, **hap; + char *bp, **ap, **hap, *obp; int type, class, buflen, ancount, qdcount; int haveanswer, had_error; char tbuf[MAXDNAME]; @@ -1238,7 +1238,9 @@ bp += nn; buflen -= nn; } + obp = bp; /* ALIGN rounds up */ bp = (char *)ALIGN(bp); + buflen -= (bp - obp); DNS_FATAL(bp + n < &hostbuf[sizeof hostbuf]); DNS_ASSERT(hap < &h_addr_ptrs[MAXADDRS-1]);