Module: wine Branch: master Commit: 93a68fa6594907078d69d813f6b58cee35abe8b4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=93a68fa6594907078d69d813f6...
Author: Frédéric Delanoy frederic.delanoy@gmail.com Date: Sat Aug 27 02:11:31 2011 +0200
cmd: Avoid reading garbage when looking for redirection handle.
---
programs/cmd/wcmdmain.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 2c1c2e5..b282e99 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -1354,11 +1354,10 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects, while (redir != NULL && ((p = strchrW(redir,'>')) != NULL)) { int handle = 0;
- if (*(p-1)!='2') { - handle = 1; - } else { + if (p > redir && (*(p-1)=='2')) handle = 2; - } + else + handle = 1;
p++; if ('>' == *p) {