wbemprox: Use a terminated string in parse_resource.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48245
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2019-12-09 13:31:12 +01:00 committed by Alexandre Julliard
parent 93a7a9037a
commit 76ee089aad
1 changed files with 2 additions and 2 deletions

View File

@ -98,7 +98,7 @@ static BOOL is_local_machine( const WCHAR *server )
static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **namespace ) static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **namespace )
{ {
static const WCHAR rootW[] = {'R','O','O','T'}; static const WCHAR rootW[] = {'R','O','O','T',0};
static const WCHAR cimv2W[] = {'C','I','M','V','2',0}; static const WCHAR cimv2W[] = {'C','I','M','V','2',0};
static const WCHAR defaultW[] = {'D','E','F','A','U','L','T',0}; static const WCHAR defaultW[] = {'D','E','F','A','U','L','T',0};
HRESULT hr = WBEM_E_INVALID_NAMESPACE; HRESULT hr = WBEM_E_INVALID_NAMESPACE;
@ -131,7 +131,7 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na
p = q; p = q;
while (*q && *q != '\\' && *q != '/') q++; while (*q && *q != '\\' && *q != '/') q++;
len = q - p; len = q - p;
if (len >= ARRAY_SIZE( rootW ) && wcsnicmp( rootW, p, len )) goto done; if (len >= ARRAY_SIZE( rootW ) - 1 && wcsnicmp( rootW, p, len )) goto done;
if (!*q) if (!*q)
{ {
hr = S_OK; hr = S_OK;