ldd: pass absolute path to bwrap
Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
478b27922c
commit
83c8f0488b
@ -3,6 +3,7 @@ package ldd
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -15,20 +16,20 @@ const lddTimeout = 2 * time.Second
|
||||
func Exec(ctx context.Context, p string) ([]*Entry, error) {
|
||||
var h helper.Helper
|
||||
|
||||
if b, err := helper.NewBwrap(
|
||||
if toolPath, err := exec.LookPath("ldd"); err != nil {
|
||||
return nil, err
|
||||
} else if h, err = helper.NewBwrap(
|
||||
(&bwrap.Config{
|
||||
Hostname: "fortify-ldd",
|
||||
Chdir: "/",
|
||||
Syscall: &bwrap.SyscallPolicy{DenyDevel: true, Multiarch: true},
|
||||
NewSession: true,
|
||||
DieWithParent: true,
|
||||
}).Bind("/", "/").DevTmpfs("/dev"), "ldd",
|
||||
}).Bind("/", "/").DevTmpfs("/dev"), toolPath,
|
||||
nil, func(_, _ int) []string { return []string{p} },
|
||||
nil, nil,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
h = b
|
||||
}
|
||||
|
||||
stdout := new(strings.Builder)
|
||||
|
Loading…
Reference in New Issue
Block a user