summaryrefslogtreecommitdiff
path: root/ext/sockets/sockaddr_conv.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/sockets/sockaddr_conv.c')
-rw-r--r--ext/sockets/sockaddr_conv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/sockets/sockaddr_conv.c b/ext/sockets/sockaddr_conv.c
index db1c2f1111..344c806049 100644
--- a/ext/sockets/sockaddr_conv.c
+++ b/ext/sockets/sockaddr_conv.c
@@ -9,7 +9,7 @@
#include <arpa/inet.h>
#endif
-extern int php_string_to_if_index(const char *val, unsigned *out);
+extern int php_string_to_if_index(const char *val, unsigned *out TSRMLS_DC);
#if HAVE_IPV6
/* Sets addr by hostname, or by ip in string form (AF_INET6) */
@@ -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 (! (host_entry = gethostbyname(string))) {
+ if (strlen(string) > MAXFQDNLEN || ! (host_entry = gethostbyname(string))) {
/* Note: < -10000 indicates a host lookup error */
#ifdef PHP_WIN32
PHP_SOCKET_ERROR(php_sock, "Host lookup failed", WSAGetLastError());