diff --git a/internal/pkg/agent/install/user_linux.go b/internal/pkg/agent/install/user_linux.go index 3386838d2a9..e5e4d4bff55 100644 --- a/internal/pkg/agent/install/user_linux.go +++ b/internal/pkg/agent/install/user_linux.go @@ -12,6 +12,7 @@ import ( "os/exec" "strconv" "strings" + "math" ) // FindGID returns the group's GID on the machine. @@ -90,6 +91,9 @@ func getentGetID(database string, key string) (int, error) { if err != nil { return -1, fmt.Errorf("failed to convert %s to int: %w", split[2], err) } + if val < 0 || val > int(math.MaxUint32) { + return -1, fmt.Errorf("ID value %d out of range [0, %d]", val, uint32(math.MaxUint32)) + } return val, nil }