userenv/tests: Fix buffer overrun.

This commit is contained in:
Dan Kegel 2008-06-03 15:04:00 -07:00 committed by Alexandre Julliard
parent 955adcbce9
commit 9d54392ca9
1 changed files with 1 additions and 1 deletions

View File

@ -137,7 +137,7 @@ static BOOL get_env(const WCHAR * env, const char * var, char ** result)
{
envlen = lstrlenW(p);
sprintf(buf, "%s", userenv_dbgstr_w(p));
if (CompareStringA(GetThreadLocale(), NORM_IGNORECASE|LOCALE_USE_CP_ACP, buf, 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] == '=')
{