summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/gethostbynis.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/net/gethostbynis.c')
-rw-r--r--lib/libc/net/gethostbynis.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/net/gethostbynis.c b/lib/libc/net/gethostbynis.c
index 386b312..e9cc205 100644
--- a/lib/libc/net/gethostbynis.c
+++ b/lib/libc/net/gethostbynis.c
@@ -171,6 +171,7 @@ _gethostbynisaddr_r(const char *addr, int len, int af, struct hostent *he,
struct hostent_data *hed)
{
char *map;
+ char numaddr[46];
switch (af) {
case AF_INET:
@@ -180,8 +181,9 @@ _gethostbynisaddr_r(const char *addr, int len, int af, struct hostent *he,
map = "ipnodes.byaddr";
break;
}
- return _gethostbynis(inet_ntoa(*(struct in_addr *)addr), map, af, he,
- hed);
+ if (inet_ntop(af, addr, numaddr, sizeof(numaddr)) == NULL)
+ return -1;
+ return _gethostbynis(numaddr, map, af, he, hed);
}
#endif /* YP */
OpenPOWER on IntegriCloud