[PATCH] wbemprox: Use a terminated string in parse_resource.
Hans Leidekker
hans at codeweavers.com
Mon Dec 9 06:31:12 CST 2019
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48245
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
dlls/wbemprox/wbemlocator.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/wbemprox/wbemlocator.c b/dlls/wbemprox/wbemlocator.c
index 99d90c357f..18c37275ed 100644
--- a/dlls/wbemprox/wbemlocator.c
+++ b/dlls/wbemprox/wbemlocator.c
@@ -98,7 +98,7 @@ static BOOL is_local_machine( const WCHAR *server )
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 defaultW[] = {'D','E','F','A','U','L','T',0};
HRESULT hr = WBEM_E_INVALID_NAMESPACE;
@@ -131,7 +131,7 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na
p = q;
while (*q && *q != '\\' && *q != '/') q++;
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)
{
hr = S_OK;
--
2.20.1
More information about the wine-devel
mailing list