msi: Don't crash on null last parameter in MsiDecomposeDescriptor.
authorHans Leidekker <hans@codeweavers.com>
Tue, 23 Mar 2010 10:48:02 +0000 (11:48 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 23 Mar 2010 12:24:27 +0000 (13:24 +0100)
dlls/msi/registry.c
dlls/msi/tests/db.c

index 1cbdcc95288896e9c38a7eb4e0c026744d060277..e0a50a3d56c09824c41540fd28d1c863f594edfa 100644 (file)
@@ -1156,7 +1156,7 @@ UINT WINAPI MsiDecomposeDescriptorW( LPCWSTR szDescriptor, LPWSTR szProduct,
     len = ( &p[21] - szDescriptor );
 
     TRACE("length = %d\n", len);
-    *pUsed = len;
+    if (pUsed) *pUsed = len;
 
     return ERROR_SUCCESS;
 }
index 8df17e82a1afc7a4c9f76605ceffb45943ce70b6..5571a71e4fcfce19e60baa36cc4c3f82ec0bbc2e 100644 (file)
@@ -479,6 +479,9 @@ static void test_msidecomposedesc(void)
     r = pMsiDecomposeDescriptorA(NULL, NULL, NULL, NULL, &len);
     ok(r == ERROR_INVALID_PARAMETER, "returned wrong error\n");
     ok(len == 0, "length wrong\n");
+
+    r = pMsiDecomposeDescriptorA(desc, NULL, NULL, NULL, NULL);
+    ok(r == ERROR_SUCCESS, "returned wrong error\n");
 }
 
 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )