p2p: fix array out of bounds issue (#23165)
This commit is contained in:
parent
bd566977e8
commit
5afc82de6e
@ -89,7 +89,7 @@ var discReasonToString = [...]string{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d DiscReason) String() 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 fmt.Sprintf("unknown disconnect reason %d", d)
|
||||||
}
|
}
|
||||||
return discReasonToString[d]
|
return discReasonToString[d]
|
||||||
|
Loading…
Reference in New Issue
Block a user