cmd: Don't overflow parameter length when copying substring.
This commit is contained in:
parent
37035e53cd
commit
7c3f3d09dd
|
@ -275,7 +275,7 @@ P0S
|
||||||
q
|
q
|
||||||
qwe
|
qwe
|
||||||
er
|
er
|
||||||
@todo_wine@'ty'@or_broken@''
|
'ty'@or_broken@''
|
||||||
't'@or_broken@''
|
't'@or_broken@''
|
||||||
ert@or_broken@qwerty
|
ert@or_broken@qwerty
|
||||||
e@or_broken@qwerty
|
e@or_broken@qwerty
|
||||||
|
|
|
@ -730,6 +730,7 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start,
|
||||||
else if (copybytes < 0) copybytes = 0;
|
else if (copybytes < 0) copybytes = 0;
|
||||||
WCMD_strsubstW(start, endOfVar + 1, startCopy, copybytes);
|
WCMD_strsubstW(start, endOfVar + 1, startCopy, copybytes);
|
||||||
} else {
|
} else {
|
||||||
|
substrlength = min(substrlength, len - (startCopy- thisVarContents + 1));
|
||||||
WCMD_strsubstW(start, endOfVar + 1, startCopy, substrlength);
|
WCMD_strsubstW(start, endOfVar + 1, startCopy, substrlength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue