cmd.exe: Fix handling of malformed environment variable expansion.

This commit is contained in:
Jason Edmeades 2007-06-03 22:07:44 +01:00 committed by Alexandre Julliard
parent afe4d80a5e
commit c4885bc46f
1 changed files with 8 additions and 2 deletions

View File

@ -1535,9 +1535,15 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start) {
/* Find the end of the environment variable, and extract name */
endOfVar = strchrW(start+1, '%');
if (endOfVar == NULL) {
/* FIXME: Some special conditions here depending on whether
/* In batch program, missing terminator for % and no following
':' just removes the '%' */
s = WCMD_strdupW(start + 1);
strcpyW (start, s);
free(s);
/* FIXME: Some other special conditions here depending on whether
in batch, complex or not, and whether env var exists or not! */
return start+1;
return start;
}
memcpy(thisVar, start, ((endOfVar - start) + 1) * sizeof(WCHAR));
thisVar[(endOfVar - start)+1] = 0x00;