diff --git a/src/ca/localHostName.cpp b/src/ca/localHostName.cpp index ba81dbc84..8ec4208d9 100644 --- a/src/ca/localHostName.cpp +++ b/src/ca/localHostName.cpp @@ -26,13 +26,13 @@ localHostName::localHostName () status = gethostname ( this->cache, sizeof ( this->cache ) ); if ( status ) { strncpy ( this->cache, "", sizeof ( this->cache ) ); - this->cache [ sizeof ( this->cache ) - 1u ] = '\0'; } } else { this->attachedToSockLib = false; strncpy ( this->cache, "", sizeof ( this->cache ) ); } + this->cache [ sizeof ( this->cache ) - 1u ] = '\0'; this->length = strlen ( this->cache ); }