mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 19:30:44 +00:00
fix: GenNewKeyRing should return out of bound error if s and ring size equal in value (#412)
This commit is contained in:
parent
743fc8500b
commit
cac03bd960
1 changed files with 16 additions and 15 deletions
|
|
@ -8,9 +8,10 @@ import (
|
|||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/XinFinOrg/XDPoSChain/common"
|
||||
"math/big"
|
||||
|
||||
"github.com/XinFinOrg/XDPoSChain/common"
|
||||
|
||||
"github.com/XinFinOrg/XDPoSChain/crypto"
|
||||
"github.com/XinFinOrg/XDPoSChain/log"
|
||||
)
|
||||
|
|
@ -273,7 +274,7 @@ func GenNewKeyRing(size int, privkey *ecdsa.PrivateKey, s int) ([]*ecdsa.PublicK
|
|||
ring := make([]*ecdsa.PublicKey, size)
|
||||
pubkey := privkey.Public().(*ecdsa.PublicKey)
|
||||
|
||||
if s > len(ring) {
|
||||
if s >= len(ring) {
|
||||
return nil, errors.New("index s out of bounds")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue