Hans Leidekker : wbemprox: Use a terminated string in parse_resource.

Alexandre Julliard julliard at winehq.org
Mon Dec 9 16:57:38 CST 2019


Module: wine
Branch: master
Commit: 76ee089aade14ddf833c4ef7c382c8d413664251
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=76ee089aade14ddf833c4ef7c382c8d413664251

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon Dec  9 13:31:12 2019 +0100

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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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;




More information about the wine-cvs mailing list