From aa00459569b670fcbb94ec8ccc0570a359a99893 Mon Sep 17 00:00:00 2001 From: micio Date: Sat, 7 Feb 2015 22:22:46 +0000 Subject: [PATCH] Bazaar/SysExec : fixed parsing arguments with embedded escaped chars git-svn-id: svn://ultimatepp.org/upp/trunk@8148 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/SysExec/ArgEnv.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/bazaar/SysExec/ArgEnv.cpp b/bazaar/SysExec/ArgEnv.cpp index cf038af8e..30d6e0d69 100644 --- a/bazaar/SysExec/ArgEnv.cpp +++ b/bazaar/SysExec/ArgEnv.cpp @@ -29,12 +29,32 @@ char **BuildArgs(String const &command, String const &argline) c = argline[++pos]; while (c && c != '"') { - s << c; - c = argline[++pos]; + if(c == '\\') + { + c = argline[++pos]; + if(!c) + break; + s << c; + c = argline[++pos]; + } + else + { + s << c; + c = argline[++pos]; + } } if (c) c = argline[++pos]; } + // read escaped characters + else if(c == '\\') + { + c = argline[++pos]; + if(!c) + break; + s << c; + c = argline[++pos]; + } else { s << c;