aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2021-10-24 22:44:38 +0200
committerStefan Weil <sw@weilnetz.de>2021-10-25 10:52:01 +0200
commitd7662edf66b703b86d4405c86f3cf7dc2291689e (patch)
treef18b085aa375178218e6e50f25a1e60c1ca85b68
parent283ce3de6c1823743b8a2dd7f7897cdc1a5c9815 (diff)
downloadpodman-d7662edf66b703b86d4405c86f3cf7dc2291689e.tar.gz
podman-d7662edf66b703b86d4405c86f3cf7dc2291689e.tar.bz2
podman-d7662edf66b703b86d4405c86f3cf7dc2291689e.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>
-rw-r--r--libpod/info.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/libpod/info.go b/libpod/info.go
index a2fd18491..8d0b19f23 100644
--- a/libpod/info.go
+++ b/libpod/info.go
@@ -332,7 +332,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