Alexandre Julliard : userenv/tests: Don' t depend on the Ascii length to find the next env variable.
Alexandre Julliard
julliard at winehq.org
Thu Aug 20 12:58:53 CDT 2009
Module: wine
Branch: master
Commit: c8c839a9bcabfb9da2867a89916098f0caf930f3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c8c839a9bcabfb9da2867a89916098f0caf930f3
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Aug 19 19:50:06 2009 +0200
userenv/tests: Don't depend on the Ascii length to find the next env variable.
---
dlls/userenv/tests/userenv.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/userenv/tests/userenv.c b/dlls/userenv/tests/userenv.c
index 3f2bba0..7c1228b 100644
--- a/dlls/userenv/tests/userenv.c
+++ b/dlls/userenv/tests/userenv.c
@@ -51,7 +51,8 @@ static BOOL get_env(const WCHAR * env, const char * var, char ** result)
varlen = strlen(var);
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 (buf[varlen] == '=')
@@ -63,7 +64,8 @@ static BOOL get_env(const WCHAR * env, const char * var, char ** result)
return TRUE;
}
}
- p = p + envlen + 1;
+ while (*p) p++;
+ p++;
} while (*p);
return FALSE;
}
More information about the wine-cvs
mailing list