cmd: Don't overflow parameter length when copying substring.

This commit is contained in:
Jason Edmeades 2012-10-25 21:17:13 +01:00 committed by Alexandre Julliard
parent 37035e53cd
commit 7c3f3d09dd
2 changed files with 2 additions and 1 deletions

View File

@ -275,7 +275,7 @@ P0S
q
qwe
er
@todo_wine@'ty'@or_broken@''
'ty'@or_broken@''
't'@or_broken@''
ert@or_broken@qwerty
e@or_broken@qwerty

View File

@ -730,6 +730,7 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start,
else if (copybytes < 0) copybytes = 0;
WCMD_strsubstW(start, endOfVar + 1, startCopy, copybytes);
} else {
substrlength = min(substrlength, len - (startCopy- thisVarContents + 1));
WCMD_strsubstW(start, endOfVar + 1, startCopy, substrlength);
}