mirror of
https://github.com/containers/podman.git
synced 2025-05-20 16:47:39 +08:00
[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>
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user