[PATCH] kernel32: GetPrivateProfileSectionNamesA error checking (Coverity)

Marcus Meissner marcus at jet.franken.de
Wed Jan 6 06:59:31 CST 2010


On Wed, Jan 06, 2010 at 01:34:28PM +0100, Alexandre Julliard wrote:
> Marcus Meissner <marcus at jet.franken.de> writes:
> 
> > buffer and size need to be either 0 at the same time or not,
> > otherwise this breaks up. Windows is inconsistent (either crashes
> > or returns invalids), so we can just add checking.
> 
> If Windows crashes we don't need extra checks. Just tell Coverity that
> crashing is allowed here.

I can't really say without a testcase. 

Could someone please run this test under some Windows versions?
(Have not setup a Win32 buildenv :/) 

Ciao, Marcus

diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c
index e3f7156..8e64e73 100644
--- a/dlls/kernel32/tests/profile.c
+++ b/dlls/kernel32/tests/profile.c
@@ -266,6 +266,10 @@ static void test_profile_sections_names(void)
     WriteFile( h, content, sizeof(content), &count, NULL);
     CloseHandle( h);
 
+    ret = GetPrivateProfileSectionNames( NULL, 2, testfile3);
+    ok (ret == 0, "NULL buf but non-0 size, expected error\n");
+    ret = GetPrivateProfileSectionNames( buf, 29, NULL);
+    ok (ret == 0, "NULL filename, expected error\n");
     /* Test with sufficiently large buffer */
     memset(buf, 0xc, sizeof(buf));
     ret = GetPrivateProfileSectionNamesA( buf, 29, testfile3 );



More information about the wine-devel mailing list