summaryrefslogtreecommitdiff
path: root/libpod/info.go
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2021-10-24 22:44:38 +0200
committerMatthew Heon <matthew.heon@pm.me>2021-11-12 11:08:25 -0500
commit955d01f5a81ffe376dd883fec118db8256fb450b (patch)
treee49c4d717e46cfb83cf7a286c41d687f3c230ca5 /libpod/info.go
parent2ff511798c44baeb7b3f6ccc413ec8eff24cfb4e (diff)
downloadpodman-955d01f5a81ffe376dd883fec118db8256fb450b.tar.gz
podman-955d01f5a81ffe376dd883fec118db8256fb450b.tar.bz2
podman-955d01f5a81ffe376dd883fec118db8256fb450b.zip
[NO NEW TESTS NEEDED] Fix off-by-one index comparision (reported by LGTM)
LGTM alert: Off-by-one index comparison against length may lead to out-of-bounds read. Signed-off-by: Stefan Weil <sw@weilnetz.de>
Diffstat (limited to 'libpod/info.go')
-rw-r--r--libpod/info.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/libpod/info.go b/libpod/info.go
index 2eba4bbff..47fda0725 100644
--- a/libpod/info.go
+++ b/libpod/info.go
@@ -333,7 +333,7 @@ func readKernelVersion() (string, error) {
return "", err
}
f := bytes.Fields(buf)
- if len(f) < 2 {
+ if len(f) < 3 {
return string(bytes.TrimSpace(buf)), nil
}
return string(f[2]), nil