diff --git a/libc/net/lib_gethostbyaddr.c b/libc/net/lib_gethostbyaddr.c index 6460e718bc6..8ef37a91512 100644 --- a/libc/net/lib_gethostbyaddr.c +++ b/libc/net/lib_gethostbyaddr.c @@ -82,6 +82,8 @@ FAR struct hostent *gethostbyaddr(FAR const void *addr, socklen_t len, int type) int ret; DEBUGASSERT(addr != NULL); + DEBUGASSERT(type == AF_INET || type == AF_INET6); + ret = gethostbyaddr_r(addr, len, type, &g_hostent, g_hostbuffer, CONFIG_NETDB_BUFSIZE, &h_errno); return ret == 0 ? &g_hostent : NULL;