mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-30 04:29:01 +01:00
Merge pull request #15 from remicollet/issue-segfault
fix uv_inet_ntop usage (+ segfault in tests/200-ares_getaddrinfo.phpt)
This commit is contained in:
commit
12b9707c68
12
php_uv.c
12
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;
|
||||
|
Loading…
Reference in New Issue
Block a user