[PATCH] kernel32: Handle username conversion failure (Coverity)
Marcus Meissner
marcus at jet.franken.de
Sat Jan 31 04:50:21 CST 2009
Hi,
CID 820, handle case where username conversion fails and
user_name is NULL later on. Print FIXME anyway (I guess
it should not happen).
Ciao, Marcus
---
dlls/kernel32/process.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 0ede42e..d15f12b 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -494,6 +494,8 @@ static void set_additional_environment(void)
user_name = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
MultiByteToWideChar( CP_UNIXCP, 0, name, -1, user_name, len );
SetEnvironmentVariableW( usernameW, user_name );
+ } else {
+ FIXME("Wine user name %s not convertable.\n", debugstr_a( name));
}
/* set the USERPROFILE and ALLUSERSPROFILE variables */
@@ -522,8 +524,10 @@ static void set_additional_environment(void)
strcpyW( value, profile_dir );
p = value + strlenW(value);
if (p > value && p[-1] != '\\') *p++ = '\\';
- strcpyW( p, user_name );
- SetEnvironmentVariableW( userprofileW, value );
+ if (user_name) {
+ strcpyW( p, user_name );
+ SetEnvironmentVariableW( userprofileW, value );
+ }
if (all_users_dir)
{
strcpyW( p, all_users_dir );
--
1.5.6
More information about the wine-patches
mailing list