From 74068e64472ec9556e0db6b40b89bd7ff8979fb1 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Sat, 27 Jun 2020 15:26:09 +0000 Subject: [PATCH] disallow negative indexes --- zkclient/settings.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zkclient/settings.go b/zkclient/settings.go index 89e7162..a86cbc6 100644 --- a/zkclient/settings.go +++ b/zkclient/settings.go @@ -298,7 +298,7 @@ func ObtainSettings() (*Settings, error) { if err != nil { return nil, fmt.Errorf("groups: %q: %v", group, err) } - if n == 0 || n > len(groups)+1 { + if n <= 0 || n > len(groups)+1 { return nil, fmt.Errorf("groups: %q: window %d unusable", group, n) } g := &openGroups[n-1]