[7/9] msi: Don't crash on null last parameter in MsiDecomposeDescriptor.

Hans Leidekker hans at codeweavers.com
Tue Mar 23 05:48:02 CDT 2010


Should fix http://bugs.winehq.org/show_bug.cgi?id=21934
---
 dlls/msi/registry.c |    2 +-
 dlls/msi/tests/db.c |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c
index 1cbdcc9..e0a50a3 100644
--- a/dlls/msi/registry.c
+++ b/dlls/msi/registry.c
@@ -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;
 }
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 8df17e8..5571a71 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -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 )
-- 
1.7.0





More information about the wine-patches mailing list