Alexandre Julliard : wbemprox: Use strncmpiW instead of memicmpW for strings without embedded nulls.
Alexandre Julliard
julliard at winehq.org
Wed May 8 18:22:48 CDT 2019
Module: wine
Branch: master
Commit: cea239e9051e8f343c1866cd8667a71fa33af4b4
URL: https://source.winehq.org/git/wine.git/?a=commit;h=cea239e9051e8f343c1866cd8667a71fa33af4b4
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed May 8 08:35:23 2019 -0500
wbemprox: Use strncmpiW instead of memicmpW for strings without embedded nulls.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 fe26a87..998dc0e 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 75ce5b0..236a37d 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;
More information about the wine-cvs
mailing list