mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-26 20:14:47 +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;
|
address = res;
|
||||||
while (address) {
|
while (address) {
|
||||||
if (address->ai_family == AF_INET) {
|
if (address->ai_family == AF_INET) {
|
||||||
const char *c;
|
|
||||||
|
|
||||||
addr = (char*) &((struct sockaddr_in*) address->ai_addr)->sin_addr;
|
addr = (char*) &((struct sockaddr_in*) address->ai_addr)->sin_addr;
|
||||||
c = uv_inet_ntop(address->ai_family, addr, ip, INET6_ADDRSTRLEN);
|
uv_inet_ntop(address->ai_family, addr, ip, INET6_ADDRSTRLEN);
|
||||||
add_next_index_string(¶ms[1], c);
|
add_next_index_string(¶ms[1], ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
address = address->ai_next;
|
address = address->ai_next;
|
||||||
@ -2111,11 +2109,9 @@ static void php_uv_getaddrinfo_cb(uv_getaddrinfo_t* handle, int status, struct a
|
|||||||
address = res;
|
address = res;
|
||||||
while (address) {
|
while (address) {
|
||||||
if (address->ai_family == AF_INET6) {
|
if (address->ai_family == AF_INET6) {
|
||||||
const char *c;
|
|
||||||
|
|
||||||
addr = (char*) &((struct sockaddr_in6*) address->ai_addr)->sin6_addr;
|
addr = (char*) &((struct sockaddr_in6*) address->ai_addr)->sin6_addr;
|
||||||
c = uv_inet_ntop(address->ai_family, addr, ip, INET6_ADDRSTRLEN);
|
uv_inet_ntop(address->ai_family, addr, ip, INET6_ADDRSTRLEN);
|
||||||
add_next_index_string(¶ms[1], c);
|
add_next_index_string(¶ms[1], ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
address = address->ai_next;
|
address = address->ai_next;
|
||||||
|
Loading…
Reference in New Issue
Block a user