Skip to content

Commit

Permalink
Merge pull request containers#11463 from flouthoc/cgroup-info-fix-panic
Browse files Browse the repository at this point in the history
cgroup-info: check if user.slice is valid before accessing value
  • Loading branch information
openshift-merge-robot authored Sep 7, 2021
2 parents 6848153 + bd64039 commit e095667
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/cgroups/cgroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@ func getCgroupPathForCurrentProcess() (string, error) {
for s.Scan() {
text := s.Text()
procEntries := strings.SplitN(text, "::", 2)
cgroupPath = procEntries[1]
// set process cgroupPath only if entry is valid
if len(procEntries) > 1 {
cgroupPath = procEntries[1]
}
}
if err := s.Err(); err != nil {
return cgroupPath, err
Expand Down

0 comments on commit e095667

Please sign in to comment.