From 367c2048a19a1f5e19bc6166f98b6c95f8215da9 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Tue, 23 Mar 2010 11:48:02 +0100 Subject: [PATCH] msi: Don't crash on null last parameter in MsiDecomposeDescriptor. --- dlls/msi/registry.c | 2 +- dlls/msi/tests/db.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c index 1cbdcc95288..e0a50a3d56c 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 8df17e82a1a..5571a71e4fc 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 ) -- 2.11.4.GIT