diff --git a/files/profile.c b/files/profile.c index 7005076c1a03ee843e8b5fe0690749bcbebcea33..e13a7c7ad9b61f997618f75a674eb9c8cf47f5a1 100644 --- a/files/profile.c +++ b/files/profile.c @@ -120,7 +120,8 @@ static void PROFILE_CopyEntry( LPWSTR buffer, LPCWSTR value, int len, return; } - for (p = value; (*p && (len > 1)); *buffer++ = *p++, len-- ) + p = value; + while (*p && (len > 1)) { if ((*p == '$') && (p[1] == '{')) { @@ -140,6 +141,11 @@ static void PROFILE_CopyEntry( LPWSTR buffer, LPCWSTR value, int len, } p = p2 + 1; } + else + { + *buffer++ = *p++; + len--; + } } if (quote && (len > 1)) buffer--; *buffer = '\0';