summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-09-07 09:40:39 +0200
committerGitHub <noreply@github.com>2021-09-07 09:40:39 +0200
commite095667ac8c2ccaf06dea6d4c61f51d93b736968 (patch)
tree37b8e8ae9940fd4169914110ced9408fef85a990
parent68481539a4f019229707dcee9e4f4f8465392f06 (diff)
parentbd6403927866738fdc7cdc1c0c18f2e838065637 (diff)
downloadpodman-e095667ac8c2ccaf06dea6d4c61f51d93b736968.tar.gz
podman-e095667ac8c2ccaf06dea6d4c61f51d93b736968.tar.bz2
podman-e095667ac8c2ccaf06dea6d4c61f51d93b736968.zip
Merge pull request #11463 from flouthoc/cgroup-info-fix-panic
cgroup-info: check if user.slice is valid before accessing value
-rw-r--r--pkg/cgroups/cgroups.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/cgroups/cgroups.go b/pkg/cgroups/cgroups.go
index 9cb32a364..4bb8de69b 100644
--- a/pkg/cgroups/cgroups.go
+++ b/pkg/cgroups/cgroups.go
@@ -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