Hans Leidekker : wbemprox: Reject empty queries.
Alexandre Julliard
julliard at winehq.org
Fri Jan 18 12:07:35 CST 2013
Module: wine
Branch: master
Commit: 9d9c17de2b6cb1139c014ff2ab6c465db488d653
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9d9c17de2b6cb1139c014ff2ab6c465db488d653
Author: Hans Leidekker <hans at codeweavers.com>
Date: Fri Jan 18 10:22:49 2013 +0100
wbemprox: Reject empty queries.
---
dlls/wbemprox/services.c | 2 +-
dlls/wbemprox/tests/query.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletions(-)
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 );
More information about the wine-cvs
mailing list