From 8d0ac6bb43aae1cb248d793a954423c803d99525 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 18 Jun 2010 13:36:48 +0000 Subject: [PATCH] check --- src/util/resolver_api.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index 430c4ebae..8905810d4 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c @@ -189,17 +189,27 @@ no_resolve (const struct sockaddr *sa, socklen_t salen) case AF_INET: if (salen != sizeof (struct sockaddr_in)) return NULL; - inet_ntop (AF_INET, - &((struct sockaddr_in *) sa)->sin_addr, - inet4, INET_ADDRSTRLEN); + if (NULL == + inet_ntop (AF_INET, + &((struct sockaddr_in *) sa)->sin_addr, + inet4, INET_ADDRSTRLEN)) + { + GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "inet_ntop"); + return NULL; + } ret = GNUNET_strdup (inet4); break; case AF_INET6: if (salen != sizeof (struct sockaddr_in6)) return NULL; - inet_ntop (AF_INET6, - &((struct sockaddr_in6 *) sa)->sin6_addr, - inet6, INET6_ADDRSTRLEN); + if (NULL == + inet_ntop (AF_INET6, + &((struct sockaddr_in6 *) sa)->sin6_addr, + inet6, INET6_ADDRSTRLEN)) + { + GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "inet_ntop"); + return NULL; + } ret = GNUNET_strdup (inet6); break; default: -- 2.25.1