KERNEL32: Make sure not to strcpy from a NULL default value pointer.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

KERNEL32: Make sure not to strcpy from a NULL default value pointer.

Mike McCormack
ChangeLog:
Make sure not to strcpy from a NULL default value pointer.

38219aa7fc761cb7ab898c03242a7505387298f1
diff --git a/dlls/kernel/profile.c b/dlls/kernel/profile.c
--- a/dlls/kernel/profile.c
+++ b/dlls/kernel/profile.c
@@ -1112,10 +1112,12 @@ static int PROFILE_GetPrivateProfileStri
  else
     /* PROFILE_GetString can handle the 'entry == NULL' case */
             ret = PROFILE_GetString( section, entry, pDefVal, buffer, len, win32 );
-    } else {
+    } else if (buffer && pDefVal) {
        lstrcpynW( buffer, pDefVal, len );
        ret = strlenW( buffer );
     }
+    else
+       ret = 0;
 
     RtlLeaveCriticalSection( &PROFILE_CritSect );