From: jacob Date: Sat, 11 Feb 2006 18:29:55 +0000 (+0000) Subject: Failure to connect to a Unix-domain socket could cause a segfault. Fixed. X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/c24e27c631bae3139724e5a0951a12a956353bca Failure to connect to a Unix-domain socket could cause a segfault. Fixed. git-svn-id: svn://svn.tartarus.org/sgt/putty@6550 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/unix/uxnet.c b/unix/uxnet.c index 3cf1b5f0..d01a44d9 100644 --- a/unix/uxnet.c +++ b/unix/uxnet.c @@ -236,7 +236,7 @@ SockAddr sk_nonamelookup(const char *host) static int sk_nextaddr(SockAddr addr) { #ifndef NO_IPV6 - if (addr->ai->ai_next) { + if (addr->ai && addr->ai->ai_next) { addr->ai = addr->ai->ai_next; addr->family = addr->ai->ai_family; return TRUE; @@ -1282,9 +1282,10 @@ SockAddr platform_get_x11_unix_address(int displaynum, char **canonicalname) else *canonicalname = dupstr(ret->hostname); #ifndef NO_IPV6 - ret->ais = NULL; + ret->ai = ret->ais = NULL; #else ret->addresses = NULL; + ret->curraddr = ret->naddresses = 0; #endif return ret; }