Module Name: xsrc
Committed By: dholland
Date: Mon Dec 23 23:14:22 UTC 2013
Modified Files:
xsrc/xfree/xc/programs/xdm: access.c
Log Message:
Don't crash if the local hostname doesn't resolve. PR 26998
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8 -r1.2 xsrc/xfree/xc/programs/xdm/access.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/xfree/xc/programs/xdm/access.c
diff -u xsrc/xfree/xc/programs/xdm/access.c:1.1.1.8 xsrc/xfree/xc/programs/xdm/access.c:1.2
--- xsrc/xfree/xc/programs/xdm/access.c:1.1.1.8 Fri Mar 18 13:09:17 2005
+++ xsrc/xfree/xc/programs/xdm/access.c Mon Dec 23 23:14:22 2013
@@ -138,8 +138,16 @@ getLocalAddress (void)
struct hostent *hostent;
hostent = gethostbyname (localHostname());
- XdmcpAllocARRAY8 (&localAddress, hostent->h_length);
- memmove( localAddress.data, hostent->h_addr, hostent->h_length);
+ if (hostent) {
+ XdmcpAllocARRAY8 (&localAddress, hostent->h_length);
+ memmove( localAddress.data, hostent->h_addr, hostent->h_length);
+ } else {
+ XdmcpAllocARRAY8 (&localAddress, 4);
+ localAddress.data[0] = 127;
+ localAddress.data[1] = 0;
+ localAddress.data[2] = 0;
+ localAddress.data[3] = 1;
+ }
#endif
}