Only sanitize user input
This commit is contained in:
parent
663a4e8920
commit
8480882b32
4
main.go
4
main.go
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user