wbemprox: Reject empty queries.

oldstable
Hans Leidekker 2013-01-18 10:22:49 +01:00 committed by Alexandre Julliard
parent d72394e7fa
commit 9d9c17de2b
2 changed files with 7 additions and 1 deletions

View File

@ -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 );
}

View File

@ -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 );