diff -ur tigervnc-1.3.0.orig/common/network/TcpSocket.cxx tigervnc-1.3.0/common/network/TcpSocket.cxx
--- tigervnc-1.3.0.orig/common/network/TcpSocket.cxx	2014-02-07 16:35:24.644388330 +0200
+++ tigervnc-1.3.0/common/network/TcpSocket.cxx	2014-02-07 16:39:50.608078320 +0200
@@ -31,6 +31,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
+#include <limits.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
 #include <netdb.h>
@@ -450,7 +451,10 @@
 }
 
 void TcpListener::getMyAddresses(std::list<char*>* result) {
-  const hostent* addrs = gethostbyname(0);
+  char hostname[HOST_NAME_MAX];
+  if (gethostname(hostname, HOST_NAME_MAX) < 0)
+    throw rdr::SystemException("gethostname", errorNumber);
+  const hostent* addrs = gethostbyname(hostname);
   if (addrs == 0)
     throw rdr::SystemException("gethostbyname", errorNumber);
   if (addrs->h_addrtype != AF_INET)