mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-20 22:26:15 +00:00
consensus: HasVoteMessage index boundary check (#7720)
Went through #2871, there are several issues, this PR tries to tackle the `HasVoteMessage` with an invalid validator index sent by a bad peer and it prevents the bad vote goes to the peerMsgQueue. Future work, check other bad message cases and plumbing the reactor errors with the peer manager and then can disconnect the peer sending the bad messages.
This commit is contained in:
@@ -72,7 +72,7 @@ func (bA *BitArray) getIndex(i int) bool {
|
||||
}
|
||||
|
||||
// SetIndex sets the bit at index i within the bit array.
|
||||
// The behavior is undefined if i >= bA.Bits
|
||||
// This method returns false if i is out of range of the BitArray.
|
||||
func (bA *BitArray) SetIndex(i int, v bool) bool {
|
||||
if bA == nil {
|
||||
return false
|
||||
@@ -83,7 +83,7 @@ func (bA *BitArray) SetIndex(i int, v bool) bool {
|
||||
}
|
||||
|
||||
func (bA *BitArray) setIndex(i int, v bool) bool {
|
||||
if i >= bA.Bits {
|
||||
if i < 0 || i >= bA.Bits {
|
||||
return false
|
||||
}
|
||||
if v {
|
||||
|
||||
Reference in New Issue
Block a user