Launchpad has imported 1 comments from the remote bug at
https://bugzilla.xfce.org/show_bug.cgi?id=11282.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2014-11-05T19:58:26+00:00 Alistair Buxton wrote:

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".
       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.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/xfwm4/+bug/1233107/comments/8


** Changed in: xfwm4
       Status: Unknown => Confirmed

** Changed in: xfwm4
   Importance: Unknown => Medium

** Bug watch added: Red Hat Bugzilla #1085082
   https://bugzilla.redhat.com/show_bug.cgi?id=1085082

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1233107

Title:
  xfwm4 crashed with SIGSEGV in clientTerminate()

To manage notifications about this bug go to:
https://bugs.launchpad.net/xfwm4/+bug/1233107/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to