From 91ea715fe7b734bb4231b4423d4c76906f1c77b4 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Mon, 4 Nov 2019 22:19:30 +0100 Subject: [PATCH] Sanitize user input --- commands/fun/tts/{dectalk => dectalk.js} | 2 +- commands/fun/tts/{dectalkvc => dectalkvc.js} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename commands/fun/tts/{dectalk => dectalk.js} (95%) rename commands/fun/tts/{dectalkvc => dectalkvc.js} (96%) diff --git a/commands/fun/tts/dectalk b/commands/fun/tts/dectalk.js similarity index 95% rename from commands/fun/tts/dectalk rename to commands/fun/tts/dectalk.js index 291b83e1..c95f2ce5 100644 --- a/commands/fun/tts/dectalk +++ b/commands/fun/tts/dectalk.js @@ -29,7 +29,7 @@ class dectalkCommand extends Command { async exec(message, args) { args.decMessage = rand.random(args.decMessage, message); args.decMessage = args.decMessage.replace('\n', ' '); - let decMessage = '[:phoneme on] ' + args.decMessage; + let decMessage = '[:phoneme on] ' + args.decMessage.replace(/(["\s'$`\\])/g,'\\$1'); if (process.platform == 'win32') { exec(`cd .\\dectalk && .\\say.exe -w dectalk.wav "${decMessage}"`) diff --git a/commands/fun/tts/dectalkvc b/commands/fun/tts/dectalkvc.js similarity index 96% rename from commands/fun/tts/dectalkvc rename to commands/fun/tts/dectalkvc.js index 2bad3b95..21e9b53b 100644 --- a/commands/fun/tts/dectalkvc +++ b/commands/fun/tts/dectalkvc.js @@ -29,7 +29,7 @@ class dectalkvcCommand extends Command { async exec(message, args) { args.decMessage = rand.random(args.decMessage, message); args.decMessage = args.decMessage.replace('\n', ' '); - let decMessage = '[:phoneme on] ' + args.decMessage; + let decMessage = '[:phoneme on] ' + args.decMessage.replace(/(["\s'$`\\])/g,'\\$1'); if (process.platform == 'win32') { exec(`cd .\\dectalk && .\\say.exe -w dectalkvc.wav "${decMessage}"`)