diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-10-03 19:48:11 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-10-03 19:48:11 +0000 |
commit | 50af6fefc1baf1399761f3924d27b792d023570b (patch) | |
tree | 520c8bc7d1d4c86a57bc642a4a8e042ae515b600 /lib | |
parent | 387bbf849f5a5e3a5f09635955535971d8d48889 (diff) |
Fix off-by-one, patch from Patrick Latifi; closes PR 3492
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/net/gethostnamadr.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c index 0be63bec835..89afb634f1a 100644 --- a/lib/libc/net/gethostnamadr.c +++ b/lib/libc/net/gethostnamadr.c @@ -48,7 +48,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.57 2003/06/27 22:23:05 vincent Exp $"; +static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.58 2003/10/03 19:48:10 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -231,19 +231,19 @@ getanswer(answer, anslen, qname, qtype) continue; } cp += n; /* name */ - if (cp > eom) + if (cp >= eom) break; type = _getshort(cp); cp += INT16SZ; /* type */ - if (cp > eom) + if (cp >= eom) break; class = _getshort(cp); cp += INT16SZ + INT32SZ; /* class, TTL */ - if (cp > eom) + if (cp >= eom) break; n = _getshort(cp); cp += INT16SZ; /* len */ - if (cp > eom) + if (cp >= eom) break; if (type == T_SIG) { /* XXX - ignore signatures as we don't use them yet */ |