Commit 5493b772 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

kernel32: Handle username conversion failure (Coverity).

parent 2c7ac136
...@@ -495,6 +495,7 @@ static void set_additional_environment(void) ...@@ -495,6 +495,7 @@ static void set_additional_environment(void)
MultiByteToWideChar( CP_UNIXCP, 0, name, -1, user_name, len ); MultiByteToWideChar( CP_UNIXCP, 0, name, -1, user_name, len );
SetEnvironmentVariableW( usernameW, user_name ); SetEnvironmentVariableW( usernameW, user_name );
} }
else WARN( "user name %s not convertible.\n", debugstr_a(name) );
/* set the USERPROFILE and ALLUSERSPROFILE variables */ /* set the USERPROFILE and ALLUSERSPROFILE variables */
...@@ -522,8 +523,10 @@ static void set_additional_environment(void) ...@@ -522,8 +523,10 @@ static void set_additional_environment(void)
strcpyW( value, profile_dir ); strcpyW( value, profile_dir );
p = value + strlenW(value); p = value + strlenW(value);
if (p > value && p[-1] != '\\') *p++ = '\\'; if (p > value && p[-1] != '\\') *p++ = '\\';
strcpyW( p, user_name ); if (user_name) {
SetEnvironmentVariableW( userprofileW, value ); strcpyW( p, user_name );
SetEnvironmentVariableW( userprofileW, value );
}
if (all_users_dir) if (all_users_dir)
{ {
strcpyW( p, all_users_dir ); strcpyW( p, all_users_dir );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment