From ae6a38a1fa632b1490f6092ac9700d17cb2343d1 Mon Sep 17 00:00:00 2001 From: ptv Date: Fri, 30 Jun 2006 09:00:20 +0000 Subject: [PATCH] initialisation of variables --- src/Utils/Utils_Identity.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Utils/Utils_Identity.cxx b/src/Utils/Utils_Identity.cxx index 661cebbcc..5fc40ae1a 100644 --- a/src/Utils/Utils_Identity.cxx +++ b/src/Utils/Utils_Identity.cxx @@ -83,8 +83,10 @@ const char* duplicate( const char *const str ) ; const char* get_uname( void ) { - char* hostName = new char[256]; - DWORD nSize = 256; + char* hostName = new char[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD nSize = MAX_COMPUTERNAME_LENGTH; + // initialisaton + hostName[0]='\0'; ASSERT(GetComputerName(hostName, &nSize)); return hostName; } @@ -98,7 +100,9 @@ const char* const get_pwname( void ) { DWORD dwSize = 256 + 1; char* retVal = new char[256]; - ASSERT(GetUserName ( retVal, &dwSize )); + // initialisaton + retVal[0]='\0'; + ASSERT(GetUserName` ( retVal, &dwSize )); return retVal; } -- 2.39.2