From 5afc82de6e617f8613577401b0e9e612703b97b6 Mon Sep 17 00:00:00 2001 From: Evolution404 <35091674+Evolution404@users.noreply.github.com> Date: Tue, 6 Jul 2021 15:33:51 +0800 Subject: [PATCH] p2p: fix array out of bounds issue (#23165) --- p2p/peer_error.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p2p/peer_error.go b/p2p/peer_error.go index ab61bfef06..393cc86b09 100644 --- a/p2p/peer_error.go +++ b/p2p/peer_error.go @@ -89,7 +89,7 @@ var discReasonToString = [...]string{ } func (d DiscReason) String() string { - if len(discReasonToString) < int(d) { + if len(discReasonToString) <= int(d) { return fmt.Sprintf("unknown disconnect reason %d", d) } return discReasonToString[d]