Gijs Vermeulen : wbemprox: Don't crash in IWbemClassObject::Put() when called with empty class object.
Alexandre Julliard
julliard at winehq.org
Tue Nov 10 13:46:24 CST 2020
Module: wine
Branch: stable
Commit: 92305238df1d041c688ce6deb2fa0c1e37cbcaef
URL: https://source.winehq.org/git/wine.git/?a=commit;h=92305238df1d041c688ce6deb2fa0c1e37cbcaef
Author: Gijs Vermeulen <gijsvrm at gmail.com>
Date: Tue Aug 11 12:01:47 2020 +0200
wbemprox: Don't crash in IWbemClassObject::Put() when called with empty class object.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40945
Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit c3bd08b02299e3ac89b708ff3bd4bda262ec6bde)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/wbemprox/class.c | 3 +++
dlls/wbemprox/tests/query.c | 9 ++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c
index 3ee5771e6b0..a2e04d1a15c 100644
--- a/dlls/wbemprox/class.c
+++ b/dlls/wbemprox/class.c
@@ -455,6 +455,9 @@ static HRESULT WINAPI class_object_Put(
if ((hr = get_column_index( co->record->table, wszName, &index )) != S_OK) return hr;
return record_set_value( co->record, index, pVal );
}
+
+ if (!ec) return S_OK;
+
return put_propval( ec->query->view, co->index, wszName, pVal, Type );
}
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index be05165542c..31cf93b4ac9 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -263,7 +263,7 @@ static void test_Win32_Service( IWbemServices *services )
static const WCHAR emptyW[] = {0};
BSTR class = SysAllocString( serviceW ), empty = SysAllocString( emptyW ), method;
IWbemClassObject *service, *out;
- VARIANT state, retval;
+ VARIANT state, retval, classvar;
CIMTYPE type;
HRESULT hr;
@@ -343,6 +343,13 @@ static void test_Win32_Service( IWbemServices *services )
hr = IWbemServices_GetObject( services, NULL, 0, NULL, &service, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( !!service, "expected non-NULL service\n" );
+
+ VariantInit(&classvar);
+ V_VT(&classvar) = VT_BSTR;
+ V_BSTR(&classvar) = SysAllocString(L"MyClass");
+ hr = IWbemClassObject_Put(service, L"__CLASS", 0, &classvar, 0);
+ ok( hr == S_OK, "got %08x\n", hr );
+ VariantClear(&classvar);
IWbemClassObject_Release( service );
service = NULL;
More information about the wine-cvs
mailing list