diff options
Diffstat (limited to 'lib/libc/net/gethostbydns.c')
-rw-r--r-- | lib/libc/net/gethostbydns.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libc/net/gethostbydns.c b/lib/libc/net/gethostbydns.c index 1044727..0effbe4 100644 --- a/lib/libc/net/gethostbydns.c +++ b/lib/libc/net/gethostbydns.c @@ -587,9 +587,13 @@ _dns_gethostbyname(void *rval, void *cb_data, va_list ap) break; } - if ((n = res_search(name, C_IN, type, buf.buf, sizeof(buf))) < 0) { + n = res_search(name, C_IN, type, buf.buf, sizeof(buf.buf)); + if (n < 0) { dprintf("res_search failed (%d)\n", n); - return NS_UNAVAIL; + return (NULL); + } else if (n > sizeof(buf.buf)) { + dprintf("static buffer is too small (%d)\n", n); + return (NULL); } *(struct hostent **)rval = gethostanswer(&buf, n, name, type); return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND; |