Don't read uninitialized data when a '$' is found.

This commit is contained in:
Adam Gundy 2003-03-30 01:35:07 +00:00 committed by Alexandre Julliard
parent 60b28eedfd
commit 8e94fbf305
1 changed files with 7 additions and 1 deletions

View File

@ -120,7 +120,8 @@ static void PROFILE_CopyEntry( LPWSTR buffer, LPCWSTR value, int len,
return; return;
} }
for (p = value; (*p && (len > 1)); *buffer++ = *p++, len-- ) p = value;
while (*p && (len > 1))
{ {
if ((*p == '$') && (p[1] == '{')) if ((*p == '$') && (p[1] == '{'))
{ {
@ -140,6 +141,11 @@ static void PROFILE_CopyEntry( LPWSTR buffer, LPCWSTR value, int len,
} }
p = p2 + 1; p = p2 + 1;
} }
else
{
*buffer++ = *p++;
len--;
}
} }
if (quote && (len > 1)) buffer--; if (quote && (len > 1)) buffer--;
*buffer = '\0'; *buffer = '\0';