Skip to content

Commit ef1166a

Browse files
authored
Merge pull request from GHSA-5g49-rx9x-qfc6
libct/cgroups.OpenFile: clean "file" argument
2 parents 6aa4d8d + 2c9598c commit ef1166a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libcontainer/cgroups/file.go

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

13+
"github.com/opencontainers/runc/libcontainer/utils"
1314
"github.com/sirupsen/logrus"
1415
"golang.org/x/sys/unix"
1516
)
@@ -111,7 +112,7 @@ func openFile(dir, file string, flags int) (*os.File, error) {
111112
flags |= os.O_TRUNC | os.O_CREATE
112113
mode = 0o600
113114
}
114-
path := path.Join(dir, file)
115+
path := path.Join(dir, utils.CleanPath(file))
115116
if prepareOpenat2() != nil {
116117
return openFallback(path, flags, mode)
117118
}

0 commit comments

Comments
 (0)