[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Bug#2424: Solaris 2.5.1 gethostname bug in kfm.cpp
From:       Will van Geest <W.J.M.vanGeest () ITS ! TUDelft ! NL>
Date:       1999-12-15 13:03:50
[Download RAW message or body]

Package: kfm
Version: 1.1.2

OS: Solaris 2.5.1
Compiler: gcc 2.95
KDE version: 1.1.2

The Solaris version of gethostname truncates the hostname without appending
a terminating '\0' if the name is too long for the buffer. The function
displayName in kdelibs-1.1.2/kfmlib/kfm.cpp uses gethostname if
getenv("DISPLAY") doesn't return sufficient information. The buffer passed
to gethostname is only 25 characters long. If the real name is too long, the
garbage after the buffer will be included in the name. Because this garbage
is different for every call to displayName, the resulting name is different
too. This causes failures on many places in the whole of KDE.

My quick-and-dirty solution is to always put a '\0' on the last place of the
buffer, so the name will never be too long.

Will van Geest

System Engineer                         Delft University of Technology
Email: W.J.M.vGeest@ITS.TUDelft.NL      Mekelweg 4
Phone: 015-2786293                      2628 CD  Delft
Fax:   015-2786679                      The Netherlands

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic