diff options
| author | Daniel Klessing <daniel.klessing@de.fujitsu.com> | 2011-11-09 16:02:07 +0100 |
|---|---|---|
| committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2011-11-21 11:33:25 +0700 |
| commit | 9b09cdf7dcd4cf8c32b318c44071cee4a45ecf16 (patch) | |
| tree | e8ac89cb5a2fe0679114764d72b311721e23e3dc | |
| parent | 55aa40a78a6509cbce541c90351b8eb10d1552a1 (diff) | |
| download | busybox-w32-9b09cdf7dcd4cf8c32b318c44071cee4a45ecf16.tar.gz busybox-w32-9b09cdf7dcd4cf8c32b318c44071cee4a45ecf16.tar.bz2 busybox-w32-9b09cdf7dcd4cf8c32b318c44071cee4a45ecf16.zip | |
quote_arg(): correctly escape backslash characters
| -rw-r--r-- | win32/process.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/win32/process.c b/win32/process.c index cdd71182b..3ce152c45 100644 --- a/win32/process.c +++ b/win32/process.c | |||
| @@ -95,6 +95,8 @@ quote_arg(const char *arg) | |||
| 95 | } | 95 | } |
| 96 | if (*p == '"') | 96 | if (*p == '"') |
| 97 | n += count*2 + 1; | 97 | n += count*2 + 1; |
| 98 | else | ||
| 99 | n += count; | ||
| 98 | continue; | 100 | continue; |
| 99 | } | 101 | } |
| 100 | len++; | 102 | len++; |
| @@ -115,9 +117,9 @@ quote_arg(const char *arg) | |||
| 115 | count++; | 117 | count++; |
| 116 | *d++ = *arg++; | 118 | *d++ = *arg++; |
| 117 | } | 119 | } |
| 120 | while (count-- > 0) | ||
| 121 | *d++ = '\\'; | ||
| 118 | if (*arg == '"') { | 122 | if (*arg == '"') { |
| 119 | while (count-- > 0) | ||
| 120 | *d++ = '\\'; | ||
| 121 | *d++ = '\\'; | 123 | *d++ = '\\'; |
| 122 | } | 124 | } |
| 123 | } | 125 | } |
