Commit c8c839a9 authored by Alexandre Julliard's avatar Alexandre Julliard

userenv/tests: Don't depend on the Ascii length to find the next env variable.

parent 3cd91a45
...@@ -51,7 +51,8 @@ static BOOL get_env(const WCHAR * env, const char * var, char ** result) ...@@ -51,7 +51,8 @@ static BOOL get_env(const WCHAR * env, const char * var, char ** result)
varlen = strlen(var); varlen = strlen(var);
do do
{ {
envlen = WideCharToMultiByte( CP_ACP, 0, p, -1, buf, sizeof(buf), NULL, NULL ) - 1; if (!WideCharToMultiByte( CP_ACP, 0, p, -1, buf, sizeof(buf), NULL, NULL )) buf[sizeof(buf)-1] = 0;
envlen = strlen(buf);
if (CompareStringA(GetThreadLocale(), NORM_IGNORECASE|LOCALE_USE_CP_ACP, buf, min(envlen, varlen), var, varlen) == CSTR_EQUAL) if (CompareStringA(GetThreadLocale(), NORM_IGNORECASE|LOCALE_USE_CP_ACP, buf, min(envlen, varlen), var, varlen) == CSTR_EQUAL)
{ {
if (buf[varlen] == '=') if (buf[varlen] == '=')
...@@ -63,7 +64,8 @@ static BOOL get_env(const WCHAR * env, const char * var, char ** result) ...@@ -63,7 +64,8 @@ static BOOL get_env(const WCHAR * env, const char * var, char ** result)
return TRUE; return TRUE;
} }
} }
p = p + envlen + 1; while (*p) p++;
p++;
} while (*p); } while (*p);
return FALSE; return FALSE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment