mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
Fix of discreason type problem (#242)
Problem: https://github.com/advisories/GHSA-wjxw-gh3m-7pm5 Fix: add non-negative `if` condition. cannot use fix in geth (https://github.com/ethereum/go-ethereum/pull/24507) since modifying DiscReason to uint8 messes up the message encode
This commit is contained in:
parent
21c54fd1d6
commit
436faf34e1
1 changed files with 2 additions and 2 deletions
|
|
@ -93,10 +93,10 @@ var discReasonToString = [...]string{
|
|||
}
|
||||
|
||||
func (d DiscReason) String() string {
|
||||
if len(discReasonToString) < int(d) {
|
||||
if len(discReasonToString) <= int(d) || int(d) < 0 {
|
||||
return fmt.Sprintf("unknown disconnect reason %d", d)
|
||||
}
|
||||
return discReasonToString[d]
|
||||
return discReasonToString[int(d)]
|
||||
}
|
||||
|
||||
func (d DiscReason) Error() string {
|
||||
|
|
|
|||
Loading…
Reference in a new issue