Files
Christophe Fergeau 57b68ed613 qemu-wrapper: Silence gosec error
By design, this wrapper is to be invoked with `qemu-wrapper
$cmdline`, so the error reported by gosec is intentional. This commit
adds the necessary annotation to silence it.

cmd/qemu-wrapper/main.go:19:9: G204: Subprocess launched with function call as argument or cmd arguments (gosec)
	cmd := exec.Command(os.Args[2], os.Args[3:]...)
	       ^
2021-08-16 11:46:00 +02:00

28 lines
464 B
Go

package main
import (
"log"
"net"
"os"
"os/exec"
)
func main() {
conn, err := net.Dial("unix", os.Args[1])
if err != nil {
log.Fatal(err)
}
fd, err := conn.(*net.UnixConn).File()
if err != nil {
log.Fatal(err)
}
cmd := exec.Command(os.Args[2], os.Args[3:]...) // #nosec G204
cmd.ExtraFiles = append(cmd.ExtraFiles, fd)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
log.Fatal(err)
}
}