[PATCH] kernel32: handle section=NULL in WritePrivateProfileStructW (Coverity)

Marcus Meissner marcus at jet.franken.de
Sun Feb 1 04:30:14 CST 2009


Hi,

CID 69, section name NULL will just crash in the calls below and
without it we cannot work anyway. So return FALSE;

Ciao, Marcus
---
 dlls/kernel32/profile.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c
index 3c5ef1c..5dddc23 100644
--- a/dlls/kernel32/profile.c
+++ b/dlls/kernel32/profile.c
@@ -1799,6 +1799,8 @@ BOOL WINAPI WritePrivateProfileStructW (LPCWSTR section, LPCWSTR key,
 
     if (!section && !key && !buf)  /* flush the cache */
         return WritePrivateProfileStringW( NULL, NULL, NULL, filename );
+    if (!section)
+        return FALSE;
 
     /* allocate string buffer for hex chars + checksum hex char + '\0' */
     outstring = HeapAlloc( GetProcessHeap(), 0, (bufsize*2 + 2 + 1) * sizeof(WCHAR) );
-- 
1.5.6



More information about the wine-patches mailing list