瀏覽代碼

Fix args string encoding. Escape quote

Serj Kalichev 7 年之前
父節點
當前提交
caaf9c6402
共有 1 個文件被更改,包括 4 次插入1 次删除
  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, "\"");
 			}