wbemprox: Reject empty queries.
Hans Leidekker
hans at codeweavers.com
Fri Jan 18 03:22:49 CST 2013
Should fix http://bugs.winehq.org/show_bug.cgi?id=32744
---
dlls/wbemprox/services.c | 2 +-
dlls/wbemprox/tests/query.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/wbemprox/services.c b/dlls/wbemprox/services.c
index 663d2d0..4bcd824 100644
--- a/dlls/wbemprox/services.c
+++ b/dlls/wbemprox/services.c
@@ -527,7 +527,7 @@ static HRESULT WINAPI wbem_services_ExecQuery(
TRACE("%p, %s, %s, 0x%08x, %p, %p\n", iface, debugstr_w(strQueryLanguage),
debugstr_w(strQuery), lFlags, pCtx, ppEnum);
- if (!strQueryLanguage || !strQuery) return WBEM_E_INVALID_PARAMETER;
+ if (!strQueryLanguage || !strQuery || !strQuery[0]) return WBEM_E_INVALID_PARAMETER;
if (strcmpiW( strQueryLanguage, wqlW )) return WBEM_E_INVALID_QUERY_TYPE;
return exec_query( strQuery, ppEnum );
}
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index 71c613a..1096caa 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -69,6 +69,7 @@ static HRESULT exec_query( IWbemServices *services, const WCHAR *str, IEnumWbemC
static void test_select( IWbemServices *services )
{
+ static const WCHAR emptyW[] = {0};
static const WCHAR sqlW[] = {'S','Q','L',0};
static const WCHAR query1[] =
{'S','E','L','E','C','T',' ','H','O','T','F','I','X','I','D',' ','F','R','O','M',' ',
@@ -113,6 +114,11 @@ static void test_select( IWbemServices *services )
hr = IWbemServices_ExecQuery( services, sql, NULL, 0, NULL, &result );
ok( hr == WBEM_E_INVALID_PARAMETER, "query failed %08x\n", hr );
+ SysFreeString( query );
+ query = SysAllocString( emptyW );
+ hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
+ ok( hr == WBEM_E_INVALID_PARAMETER, "query failed %08x\n", hr );
+
for (i = 0; i < sizeof(test)/sizeof(test[0]); i++)
{
hr = exec_query( services, test[i], &result );
--
1.7.10.4
More information about the wine-patches
mailing list