Sfoglia il codice sorgente

Escape backslashes within args

Serj Kalichev 6 anni fa
parent
commit
995e0e0d8f
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      clish/shell/shell_parse.c

+ 2 - 1
clish/shell/shell_parse.c

@@ -298,7 +298,8 @@ clish_pargv_status_e clish_shell_parse_pargv(clish_pargv_t *pargv,
 				lub_string_cat(&args, "\"");
 			}
 			/* place the current argument in the string */
-			enc = lub_string_encode(arg, "\"");
+			/* Escape quote and backslash */
+			enc = lub_string_encode(arg, lub_string_esc_quoted);
 			lub_string_cat(&args, enc);
 			lub_string_free(enc);
 			if (BOOL_TRUE == quoted) {