From a2de77df186359a031edf23ee39e20796c576261 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 28 Oct 2016 14:00:37 +0200 Subject: [PATCH] fix uv_inet_ntop usage (+ segfault in tests/200-ares_getaddrinfo.phpt --- php_uv.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/php_uv.c b/php_uv.c index 6c2f891..e722d17 100644 --- a/php_uv.c +++ b/php_uv.c @@ -2098,11 +2098,9 @@ static void php_uv_getaddrinfo_cb(uv_getaddrinfo_t* handle, int status, struct a address = res; while (address) { if (address->ai_family == AF_INET) { - const char *c; - addr = (char*) &((struct sockaddr_in*) address->ai_addr)->sin_addr; - c = uv_inet_ntop(address->ai_family, addr, ip, INET6_ADDRSTRLEN); - add_next_index_string(¶ms[1], c); + uv_inet_ntop(address->ai_family, addr, ip, INET6_ADDRSTRLEN); + add_next_index_string(¶ms[1], ip); } address = address->ai_next; @@ -2111,11 +2109,9 @@ static void php_uv_getaddrinfo_cb(uv_getaddrinfo_t* handle, int status, struct a address = res; while (address) { if (address->ai_family == AF_INET6) { - const char *c; - addr = (char*) &((struct sockaddr_in6*) address->ai_addr)->sin6_addr; - c = uv_inet_ntop(address->ai_family, addr, ip, INET6_ADDRSTRLEN); - add_next_index_string(¶ms[1], c); + uv_inet_ntop(address->ai_family, addr, ip, INET6_ADDRSTRLEN); + add_next_index_string(¶ms[1], ip); } address = address->ai_next;