Browse Source

Fix args string encoding. Escape quote

Serj Kalichev 7 years ago
parent
commit
caaf9c6402
1 changed files with 4 additions and 1 deletions
  1. 4 1
      clish/shell/shell_parse.c

+ 4 - 1
clish/shell/shell_parse.c

@@ -293,11 +293,14 @@ clish_pargv_status_e clish_shell_parse_pargv(clish_pargv_t *pargv,
 		 */
 		while (NULL != arg) {
 			bool_t quoted = lub_argv__get_quoted(argv, *idx);
+			char *enc = NULL;
 			if (BOOL_TRUE == quoted) {
 				lub_string_cat(&args, "\"");
 			}
 			/* place the current argument in the string */
-			lub_string_cat(&args, arg);
+			enc = lub_string_encode(arg, "\"");
+			lub_string_cat(&args, enc);
+			lub_string_free(enc);
 			if (BOOL_TRUE == quoted) {
 				lub_string_cat(&args, "\"");
 			}