diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-01-20 18:28:34 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-01-20 18:28:34 +0000 |
commit | ea66ae2f74cdf7205680ea10a778732d1f2173b6 (patch) | |
tree | cf575c64c35e28636572ea2fb36d519aa9b18eb8 /lib/libc | |
parent | 003381fa256f8ef05ab4dfe4ec45d5f73f45361c (diff) |
for YP lookups, avoid names longer than MAXHOSTNAMELEN
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/gethostnamadr.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c index b11bff6b866..7fb148bf528 100644 --- a/lib/libc/net/gethostnamadr.c +++ b/lib/libc/net/gethostnamadr.c @@ -52,7 +52,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.28 1998/01/11 19:32:10 weingart Exp $"; +static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.29 1998/01/20 18:28:33 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -953,6 +953,8 @@ _yp_gethtbyname(name) static char *__ypcurrent; int __ypcurrentlen, r; + if (strlen(name) >= MAXHOSTNAMELEN) + return (NULL); if (!__ypdomain) { if (_yp_check(&__ypdomain) == 0) return (hp); |