]> granicus.if.org Git - php/commitdiff
don't segfault on bindto == NULL
authorAntony Dovgal <tony2001@php.net>
Mon, 4 May 2009 14:25:04 +0000 (14:25 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 4 May 2009 14:25:04 +0000 (14:25 +0000)
main/network.c

index 873b464edd90cba133c3e90c171d087d249f987f..476f930db3c8cb2e7b2fb6d9d0345d8a6a46c9a2 100644 (file)
@@ -792,7 +792,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short
                switch (sa->sa_family) {
 #if HAVE_GETADDRINFO && HAVE_IPV6
                        case AF_INET6:
-                               if (strstr(bindto, ':')) {
+                               if (bindto && strstr(bindto, ':')) {
                                        ((struct sockaddr_in6 *)sa)->sin6_family = sa->sa_family;
                                        ((struct sockaddr_in6 *)sa)->sin6_port = htons(port);
                                        socklen = sizeof(struct sockaddr_in6);