From d7662edf66b703b86d4405c86f3cf7dc2291689e Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 24 Oct 2021 22:44:38 +0200 Subject: [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 --- libpod/info.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3-54-g00ecf