[4/6] cmd: Avoid reading garbage when looking for redirection handle (resend) (try 2)

Frédéric Delanoy frederic.delanoy at gmail.com
Fri Aug 26 19:11:31 CDT 2011


---
 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) {
-- 
1.7.6




More information about the wine-patches mailing list