diff options
-rw-r--r-- | src/lib/libc/net/gethostnamadr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libc/net/gethostnamadr.c b/src/lib/libc/net/gethostnamadr.c index c643f2382a..f0be24143c 100644 --- a/src/lib/libc/net/gethostnamadr.c +++ b/src/lib/libc/net/gethostnamadr.c | |||
@@ -48,7 +48,7 @@ | |||
48 | */ | 48 | */ |
49 | 49 | ||
50 | #if defined(LIBC_SCCS) && !defined(lint) | 50 | #if defined(LIBC_SCCS) && !defined(lint) |
51 | static const char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.61 2005/03/30 02:58:28 tedu Exp $"; | 51 | static const char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.62 2005/05/02 17:38:41 moritz Exp $"; |
52 | #endif /* LIBC_SCCS and not lint */ | 52 | #endif /* LIBC_SCCS and not lint */ |
53 | 53 | ||
54 | #include <sys/param.h> | 54 | #include <sys/param.h> |
@@ -702,7 +702,7 @@ gethostbyaddr(const char *addr, int len, int af) | |||
702 | for (n = IN6ADDRSZ - 1; n >= 0; n--) { | 702 | for (n = IN6ADDRSZ - 1; n >= 0; n--) { |
703 | i = snprintf(qp, ep - qp, "%x.%x.", | 703 | i = snprintf(qp, ep - qp, "%x.%x.", |
704 | uaddr[n] & 0xf, (uaddr[n] >> 4) & 0xf); | 704 | uaddr[n] & 0xf, (uaddr[n] >> 4) & 0xf); |
705 | if (i <= 0) { | 705 | if (i <= 0 || i >= ep - qp) { |
706 | errno = EINVAL; | 706 | errno = EINVAL; |
707 | h_errno = NETDB_INTERNAL; | 707 | h_errno = NETDB_INTERNAL; |
708 | return (NULL); | 708 | return (NULL); |