From 47fc99598ddc24f3c182c4dc3c7498ad74b7a323 Mon Sep 17 00:00:00 2001 From: Carbonhell Date: Wed, 6 Mar 2019 01:13:14 +0100 Subject: [PATCH] Escapes the quotes in the shell call so that the command does not get butchered when passed to execve --- code/__HELPERS/shell.dm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/__HELPERS/shell.dm b/code/__HELPERS/shell.dm index 8b615eac0a0..eed86a3bd10 100644 --- a/code/__HELPERS/shell.dm +++ b/code/__HELPERS/shell.dm @@ -25,7 +25,10 @@ shelleo_ids[shelleo_id] = TRUE out_file = "[SHELLEO_NAME][shelleo_id][SHELLEO_OUT]" err_file = "[SHELLEO_NAME][shelleo_id][SHELLEO_ERR]" - errorcode = shell("[interpreter] \"[command]\" > [out_file] 2> [err_file]") + if(world.system_type == UNIX) + errorcode = shell("[interpreter] \"[replacetext(command, "\"", "\\\"")]\" > [out_file] 2> [err_file]") + else + errorcode = shell("[interpreter] \"[command]\" > [out_file] 2> [err_file]") if(fexists(out_file)) stdout = file2text(out_file) fdel(out_file)