use less than full length of buffer with gethostname in case there are errors in the implementation of gethostname
This commit is contained in:
1 parent
1bb5a5d86b
commit
f5803beb8a
1 file changed
+1
-1
@@ -30,7 +30,7 @@ localHostName::localHostName ()
|
||||
int status = osiSockAttach ();
|
||||
if ( status ) {
|
||||
this->attachedToSockLib = true;
|
||||
status = gethostname ( this->cache, sizeof ( this->cache ) );
|
||||
status = gethostname ( this->cache, sizeof ( this->cache ) - 1 );
|
||||
if ( status ) {
|
||||
strncpy ( this->cache, "<unknown host>", sizeof ( this->cache ) );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user