Skip to content

Commit 3a96265

Browse files
committed
libcontainer/intelrdt: use SecureJoin in NewManager
Protects against invalid (non-validated) CLOS names. Signed-off-by: Markus Lehtonen <[email protected]>
1 parent f73e283 commit 3a96265

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libcontainer/intelrdt/intelrdt.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"strings"
1111
"sync"
1212

13+
securejoin "github.com/cyphar/filepath-securejoin"
1314
"github.com/moby/sys/mountinfo"
1415
"golang.org/x/sys/unix"
1516

@@ -173,7 +174,9 @@ func NewManager(config *configs.Config, id string, path string) *Manager {
173174
if config.IntelRdt.ClosID != "" {
174175
clos = config.IntelRdt.ClosID
175176
}
176-
path = filepath.Join(rootPath, clos)
177+
if path, err = securejoin.SecureJoin(rootPath, clos); err != nil {
178+
return nil
179+
}
177180
}
178181

179182
return newManager(config, id, path)

0 commit comments

Comments
 (0)