diff --git a/WebUI/www/api/eq3/hmscript.tcl b/WebUI/www/api/eq3/hmscript.tcl index 6d45346bc..347b3e911 100755 --- a/WebUI/www/api/eq3/hmscript.tcl +++ b/WebUI/www/api/eq3/hmscript.tcl @@ -58,7 +58,12 @@ proc hmscript_runFromFile { filename {p_args -}} { } proc hmscript_escapeString { str } { + # Backslash MUST be escaped first, otherwise a backslash placed directly + # before a quote in user input would (after the quote is escaped to \") + # be read by ReGa as an escaped backslash, closing the string literal + # early and turning the rest of the input into executable HomeMatic Script. return [string map { + "\\" "\\\\" "\'" "\\\'" "\"" "\\\"" "\n" "\\n"