Only sanitize user input

This commit is contained in:
Elara 2021-05-05 14:06:18 -07:00
parent 663a4e8920
commit 8480882b32

View File

@ -153,10 +153,10 @@ func main() {
} }
// If greater than 2 arguments, append them to cmdArr // If greater than 2 arguments, append them to cmdArr
if len(args) >= 2 { if len(args) >= 2 {
cmdArr = append(cmdArr, strings.Join(args[1:], " ")) cmdArr = append(cmdArr, shellescape.QuoteCommand(args[1:]))
} }
// Create space separated string from cmdArr // Create space separated string from cmdArr
cmdStr := shellescape.QuoteCommand(cmdArr) cmdStr := strings.Join(cmdArr, " ")
// Instantiate exec.Command object with command sh, flag -c, and cmdStr // Instantiate exec.Command object with command sh, flag -c, and cmdStr
command := exec.Command("sh", "-c", cmdStr) command := exec.Command("sh", "-c", cmdStr)
// Set standard outputs for command // Set standard outputs for command