From cea239e9051e8f343c1866cd8667a71fa33af4b4 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 8 May 2019 08:35:23 -0500 Subject: [PATCH] wbemprox: Use strncmpiW instead of memicmpW for strings without embedded nulls. Signed-off-by: Alexandre Julliard --- dlls/wbemprox/wbemlocator.c | 9 ++++----- dlls/wbemprox/wql.y | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/dlls/wbemprox/wbemlocator.c b/dlls/wbemprox/wbemlocator.c index fe26a871b50..998dc0ef636 100644 --- a/dlls/wbemprox/wbemlocator.c +++ b/dlls/wbemprox/wbemlocator.c @@ -101,8 +101,8 @@ 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 cimv2W[] = {'C','I','M','V','2'}; - static const WCHAR defaultW[] = {'D','E','F','A','U','L','T'}; + 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; const WCHAR *p, *q; unsigned int len; @@ -133,7 +133,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 ) && memicmpW( rootW, p, len )) goto done; + if (len >= ARRAY_SIZE( rootW ) && strncmpiW( rootW, p, len )) goto done; if (!*q) { hr = S_OK; @@ -141,8 +141,7 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na } q++; len = strlenW( q ); - if ((len != ARRAY_SIZE( cimv2W ) || memicmpW( q, cimv2W, len )) && - (len != ARRAY_SIZE( defaultW ) || memicmpW( q, defaultW, len ))) + if (strcmpiW( q, cimv2W ) && strcmpiW( q, defaultW )) goto done; if (!(*namespace = heap_alloc( (len + 1) * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY; else diff --git a/dlls/wbemprox/wql.y b/dlls/wbemprox/wql.y index 75ce5b0621c..236a37d9f73 100644 --- a/dlls/wbemprox/wql.y +++ b/dlls/wbemprox/wql.y @@ -579,7 +579,7 @@ static int cmp_keyword( const void *arg1, const void *arg2 ) int len = min( key1->len, key2->len ); int ret; - if ((ret = memicmpW( key1->name, key2->name, len ))) return ret; + if ((ret = strncmpiW( key1->name, key2->name, len ))) return ret; if (key1->len < key2->len) return -1; else if (key1->len > key2->len) return 1; return 0;