From 48feca800f90136f5a2d6169299f4efe5a93822c Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 16 Mar 2025 23:29:14 +0900 Subject: sandbox: check command function pointer Setting default CommandContext on initialisation is somewhat of a footgun. Signed-off-by: Ophestra --- ldd/exec.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'ldd') diff --git a/ldd/exec.go b/ldd/exec.go index 4f77ae30..94756930 100644 --- a/ldd/exec.go +++ b/ldd/exec.go @@ -26,16 +26,13 @@ func ExecFilter(ctx context.Context, c, cancel := context.WithTimeout(ctx, lddTimeout) defer cancel() container := sandbox.New(c, "ldd", p) + container.CommandContext = commandContext container.Hostname = "fortify-ldd" stdout, stderr := new(bytes.Buffer), new(bytes.Buffer) container.Stdout = stdout container.Stderr = stderr container.Bind("/", "/", 0).Dev("/dev") - if commandContext != nil { - container.CommandContext = commandContext - } - if err := container.Start(); err != nil { return nil, err } else if err = container.Serve(); err != nil { -- cgit v1.3.1