Skip to content

Commit

Permalink
Merge pull request #489 from binance-chain/addrlen
Browse files Browse the repository at this point in the history
check length of signer addresses
  • Loading branch information
rickyyangz authored Mar 9, 2019
2 parents 97282fe + 0a191c1 commit d8bcc1d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion common/tx/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,15 @@ func validateBasic(tx auth.StdTx) (err sdk.Error) {
}

// Assert that number of signatures is correct.
if signerAddrs := tx.GetSigners(); len(sigs) != len(signerAddrs) {
signerAddrs := tx.GetSigners()
if len(sigs) != len(signerAddrs) {
return sdk.ErrUnauthorized("wrong number of signers")
}
for _, signerAddr := range signerAddrs {
if len(signerAddr) != sdk.AddrLen {
return sdk.ErrInvalidAddress("contains invalid signer address")
}
}

if data := tx.GetData(); len(data) > 0 {
return sdk.ErrUnauthorized("data field is not allowed to use in transaction for now")
Expand Down

0 comments on commit d8bcc1d

Please sign in to comment.