about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--resolv/gethnamaddr.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f7d9880b24..7b26924cff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 1999-10-25  Ulrich Drepper  <drepper@cygnus.com>
 
+	* resolv/gethnamaddr.c: Account bytes needed for alignment in
+	buflen.  Patch by Olaf Kibrch <okir@lst.de>.
+
 	* md5-crypt/md5test.c: Correct names of MD5 functions after
 	removing of public names.
 
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]) {