Account bytes needed for alignment in buflen.
authordrepper <drepper>
Mon, 25 Oct 1999 22:19:43 +0000 (22:19 +0000)
committerdrepper <drepper>
Mon, 25 Oct 1999 22:19:43 +0000 (22:19 +0000)
resolv/gethnamaddr.c

index 4484b81..7f1b742 100644 (file)
@@ -420,6 +420,10 @@ getanswer(answer, anslen, qname, qtype)
                                buflen -= nn;
                        }
 
+                       /* XXX: when incrementing bp, we have to decrement
+                        * buflen by the same amount --okir */
+                       buflen -= sizeof(align) - ((u_long)bp % sizeof(align));
+
                        bp += sizeof(align) - ((u_long)bp % sizeof(align));
 
                        if (bp + n >= &hostbuf[sizeof hostbuf]) {