summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libc/net/gethostnamadr.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/libc/net/gethostnamadr.c b/src/lib/libc/net/gethostnamadr.c
index 47570f4a02..33c9643f70 100644
--- a/src/lib/libc/net/gethostnamadr.c
+++ b/src/lib/libc/net/gethostnamadr.c
@@ -52,7 +52,7 @@
52 */ 52 */
53 53
54#if defined(LIBC_SCCS) && !defined(lint) 54#if defined(LIBC_SCCS) && !defined(lint)
55static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.41 2000/01/06 08:24:17 d Exp $"; 55static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.42 2000/07/30 14:07:14 itojun Exp $";
56#endif /* LIBC_SCCS and not lint */ 56#endif /* LIBC_SCCS and not lint */
57 57
58#include <sys/param.h> 58#include <sys/param.h>
@@ -954,14 +954,14 @@ _yphostent(line)
954 q = host.h_aliases = host_aliases; 954 q = host.h_aliases = host_aliases;
955 955
956nextline: 956nextline:
957 /* check for host_addrs overflow */
958 if (buf >= &host_addrs[sizeof(host_addrs) / sizeof(host_addrs[0])])
959 goto done;
960
957 more = 0; 961 more = 0;
958 cp = strpbrk(p, " \t"); 962 cp = strpbrk(p, " \t");
959 if (cp == NULL) { 963 if (cp == NULL)
960 if (host.h_name == NULL) 964 goto done;
961 return (NULL);
962 else
963 goto done;
964 }
965 *cp++ = '\0'; 965 *cp++ = '\0';
966 966
967 *hap++ = (char *)buf; 967 *hap++ = (char *)buf;
@@ -1002,6 +1002,8 @@ nextline:
1002 *cp++ = '\0'; 1002 *cp++ = '\0';
1003 } 1003 }
1004done: 1004done:
1005 if (host.h_name == NULL)
1006 return (NULL);
1005 *q = NULL; 1007 *q = NULL;
1006 *hap = NULL; 1008 *hap = NULL;
1007 return (&host); 1009 return (&host);