-
Notifications
You must be signed in to change notification settings - Fork 1
/
exec.go
33 lines (26 loc) · 872 Bytes
/
exec.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package sanitizers
import (
"os"
"os/exec"
"github.com/CodeIntelligenceTesting/gofuzz/sanitizers/detectors"
)
func CmdCombinedOutput(hookId int, cmd *exec.Cmd) ([]byte, error) {
detectors.NewCommandInjection(hookId, cmd.Path).Detect()
return cmd.CombinedOutput()
}
func CmdOutput(hookId int, cmd *exec.Cmd) ([]byte, error) {
detectors.NewCommandInjection(hookId, cmd.Path).Detect()
return cmd.Output()
}
func CmdRun(hookId int, cmd *exec.Cmd) error {
detectors.NewCommandInjection(hookId, cmd.Path).Detect()
return cmd.Run()
}
func CmdStart(hookId int, cmd *exec.Cmd) error {
detectors.NewCommandInjection(hookId, cmd.Path).Detect()
return cmd.Start()
}
func OsStartProcess(hookId int, name string, argv []string, attr *os.ProcAttr) (*os.Process, error) {
detectors.NewCommandInjection(hookId, name).Detect()
return os.StartProcess(name, argv, attr)
}