about summary refs log tree commit diff
path: root/resolv
diff options
context:
space:
mode:
Diffstat (limited to 'resolv')
-rw-r--r--resolv/gethnamaddr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index 4484b81ce7..7f1b742c4d 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -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]) {