summaryrefslogtreecommitdiff
path: root/ext/sockets
diff options
context:
space:
mode:
authorJoe Watkins <krakjoe@php.net>2016-03-31 12:39:01 +0100
committerJoe Watkins <krakjoe@php.net>2016-03-31 12:39:01 +0100
commit233115ea236fd1aa258e8b733d3855d1261fba8b (patch)
treedb5f522d2d1787169e25b8f2cc4b485e0c67f72e /ext/sockets
parented06d130f70691cb50bed9dc7b9db38970a9d408 (diff)
downloadphp-git-233115ea236fd1aa258e8b733d3855d1261fba8b.tar.gz
fix #71609: Segmentation fault on ZTS with gethostbyname
Diffstat (limited to 'ext/sockets')
-rw-r--r--ext/sockets/sockaddr_conv.c2
-rw-r--r--ext/sockets/sockets.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/ext/sockets/sockaddr_conv.c b/ext/sockets/sockaddr_conv.c
index 73a0085720..1ce109ee8c 100644
--- a/ext/sockets/sockaddr_conv.c
+++ b/ext/sockets/sockaddr_conv.c
@@ -90,7 +90,7 @@ int php_set_inet_addr(struct sockaddr_in *sin, char *string, php_socket *php_soc
if (inet_aton(string, &tmp)) {
sin->sin_addr.s_addr = tmp.s_addr;
} else {
- if (strlen(string) > MAXFQDNLEN || ! (host_entry = gethostbyname(string))) {
+ if (strlen(string) > MAXFQDNLEN || ! (host_entry = php_network_gethostbyname(string))) {
/* Note: < -10000 indicates a host lookup error */
#ifdef PHP_WIN32
PHP_SOCKET_ERROR(php_sock, "Host lookup failed", WSAGetLastError());
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index a207225f1c..6039ac65ba 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -425,9 +425,9 @@ static int php_open_listen_sock(php_socket **php_sock, int port, int backlog) /*
*php_sock = sock;
#ifndef PHP_WIN32
- if ((hp = gethostbyname("0.0.0.0")) == NULL) {
+ if ((hp = php_network_gethostbyname("0.0.0.0")) == NULL) {
#else
- if ((hp = gethostbyname("localhost")) == NULL) {
+ if ((hp = php_network_gethostbyname("localhost")) == NULL) {
#endif
efree(sock);
return 0;