From 9803b24aa9da12e684ffb6b9e97c06f484e1d137 Mon Sep 17 00:00:00 2001 From: "W. Eric Norum" Date: Fri, 13 Jul 2001 18:48:03 +0000 Subject: [PATCH] Ensure that host name is always null-terminated. --- src/ca/localHostName.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ); }