If you check the environment file posted, the hostname is 33 characters.
Patch is attached which uses HOST_NAME_MAX to determine the maximum hostname length. If not defined, it is defined to 255. From the gethostname (Linux) man page:
SUSv2 guarantees that "Host names are limited to 255 bytes".
POSIX.1-2001 guarantees that "Host names (not including the terminating
null byte) are limited to HOST_NAME_MAX bytes". On Linux, HOST_NAME_MAX is defined with the value 64, which has been the limit
since Linux 1.0 (earlier kernels imposed a limit of 8 bytes).
The patch also adds a warning if gethostname still fails, and a null check in when the hostname is tested.
Created attachment 5727
Determine max hostname
In display.c:
#define MAX_HOSTNAME_LENGTH 32
This includes the null byte, so the limit is really 31 characters. The real limit is 64+1 on Linux and 255+1 on BSD.
If the buffer is not big enough for the hostname, gethostname will return ENAMETOOLONG and the hostname will be set to NULL.
Later, when a client is killed, the hostname is tested with strcmp, which causes a segfault.
Example of the bug:
https:/ /bugzilla. redhat. com/show_ bug.cgi? id=1085082
If you check the environment file posted, the hostname is 33 characters.
Patch is attached which uses HOST_NAME_MAX to determine the maximum hostname length. If not defined, it is defined to 255. From the gethostname (Linux) man page:
SUSv2 guarantees that "Host names are limited to 255 bytes".
HOST_NAME_ MAX is defined with the value 64, which has been the limit
POSIX.1-2001 guarantees that "Host names (not including the terminating
null byte) are limited to HOST_NAME_MAX bytes". On Linux,
since Linux 1.0 (earlier kernels imposed a limit of 8 bytes).
The patch also adds a warning if gethostname still fails, and a null check in when the hostname is tested.