Browse Source

Escape backslashes within args

Serj Kalichev 6 years ago
parent
commit
995e0e0d8f
1 changed files with 2 additions and 1 deletions
  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) {