Parcourir la source

Fix args string encoding. Escape quote

Serj Kalichev il y a 6 ans
Parent
commit
caaf9c6402
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  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, "\"");
 			}