Paul Vriens : kernel32/profile: Add a few NULL checks (Coverity).
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Mar 28 06:41:48 CDT 2007
Module: wine
Branch: master
Commit: 4a431afd6914b47c5aefe188ed42b89159e984f6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4a431afd6914b47c5aefe188ed42b89159e984f6
Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date: Tue Mar 27 22:08:14 2007 +0200
kernel32/profile: Add a few NULL checks (Coverity).
---
dlls/kernel32/profile.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c
index 0abb887..27a3d06 100644
--- a/dlls/kernel32/profile.c
+++ b/dlls/kernel32/profile.c
@@ -1322,7 +1322,13 @@ UINT WINAPI GetPrivateProfileIntA( LPCSTR section, LPCSTR entry,
INT WINAPI GetPrivateProfileSectionW( LPCWSTR section, LPWSTR buffer,
DWORD len, LPCWSTR filename )
{
- int ret = 0;
+ int ret = 0;
+
+ if (!section || !buffer)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return 0;
+ }
TRACE("(%s, %p, %d, %s)\n", debugstr_w(section), buffer, len, debugstr_w(filename));
@@ -1346,9 +1352,14 @@ INT WINAPI GetPrivateProfileSectionA( LPCSTR section, LPSTR buffer,
LPWSTR bufferW;
INT retW, ret = 0;
- bufferW = buffer ? HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)) : NULL;
- if (section) RtlCreateUnicodeStringFromAsciiz(§ionW, section);
- else sectionW.Buffer = NULL;
+ if (!section || !buffer)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return 0;
+ }
+
+ bufferW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ RtlCreateUnicodeStringFromAsciiz(§ionW, section);
if (filename) RtlCreateUnicodeStringFromAsciiz(&filenameW, filename);
else filenameW.Buffer = NULL;
More information about the wine-cvs
mailing list