summaryrefslogtreecommitdiff
path: root/Ivy/Ivy.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Ivy/Ivy.cxx')
-rw-r--r--Ivy/Ivy.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/Ivy/Ivy.cxx b/Ivy/Ivy.cxx
index c70d23f..daa2129 100644
--- a/Ivy/Ivy.cxx
+++ b/Ivy/Ivy.cxx
@@ -89,9 +89,17 @@ const char * Ivy::GetDomain(const char *domainlist)
if ( domain.empty() )
{
#ifndef UNDER_CE
- const char *env = getenv ( "IVYBUS" );
- if ( env )
+ size_t requiredSize;
+
+ getenv_s( &requiredSize, NULL, 0, "IVYBUS");
+
+ if ( requiredSize )
+ {
+ char *env = (char*)malloc( requiredSize * sizeof(char));
+ getenv_s( &requiredSize, env, requiredSize, "IVYBUS");
domain = env;
+ free( env );
+ }
#endif
if ( domain.empty() )
domain = DEFAULT_DOMAIN;
@@ -148,7 +156,7 @@ int Ivy::BindMsg( IvyMessageCallback *cb, const char *regexp, ... )
va_list args;
va_start( args, regexp ); /* Initialize variable arguments. */
- _vsnprintf( buffer, sizeof(buffer), regexp, args );
+ _vsnprintf_s( buffer, sizeof(buffer), sizeof(buffer)-1, regexp, args );
va_end( args);
regexp_out.push_back( regexp );
@@ -243,7 +251,7 @@ int Ivy::SendMsg(const char * message, ... )
va_list args;
va_start( args, message ); /* Initialize variable arguments. */
- _vsnprintf( buffer, sizeof(buffer), message, args );
+ _vsnprintf_s( buffer, sizeof(buffer), sizeof(buffer)-1, message, args );
va_end( args);
/* send to already connected */
IvyApplicationList::iterator iter;