diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-04-01 19:55:42 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-04-01 19:55:42 +0800 |
commit | 4a4da9a24e39c45db6535ca5ad51dc1385f2491b (patch) | |
tree | c5b31c90566931e6a1a859f98da549181805f62c /eth/protocol.go | |
parent | 936ddf2ad1b7306dfe7f5ae9ca122a4968dd98e8 (diff) | |
parent | f56fc9cd9d13e88ee1a244ea590e249e324b8b84 (diff) | |
download | dexon-4a4da9a24e39c45db6535ca5ad51dc1385f2491b.tar dexon-4a4da9a24e39c45db6535ca5ad51dc1385f2491b.tar.gz dexon-4a4da9a24e39c45db6535ca5ad51dc1385f2491b.tar.bz2 dexon-4a4da9a24e39c45db6535ca5ad51dc1385f2491b.tar.lz dexon-4a4da9a24e39c45db6535ca5ad51dc1385f2491b.tar.xz dexon-4a4da9a24e39c45db6535ca5ad51dc1385f2491b.tar.zst dexon-4a4da9a24e39c45db6535ca5ad51dc1385f2491b.zip |
Merge pull request #588 from ethersphere/frontier/SEC-29
Frontier/sec 29
Diffstat (limited to 'eth/protocol.go')
-rw-r--r-- | eth/protocol.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/eth/protocol.go b/eth/protocol.go index e32ea233b..a0ab177cd 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -185,7 +185,10 @@ func (self *ethProtocol) handle() error { if err := msg.Decode(&txs); err != nil { return self.protoError(ErrDecode, "msg %v: %v", msg, err) } - for _, tx := range txs { + for i, tx := range txs { + if tx == nil { + return self.protoError(ErrDecode, "transaction %d is nil", i) + } jsonlogger.LogJson(&logger.EthTxReceived{ TxHash: tx.Hash().Hex(), RemoteId: self.peer.ID().String(), @@ -268,6 +271,9 @@ func (self *ethProtocol) handle() error { return self.protoError(ErrDecode, "msg %v: %v", msg, err) } } + if err := block.ValidateFields(); err != nil { + return self.protoError(ErrDecode, "block validation %v: %v", msg, err) + } self.blockPool.AddBlock(&block, self.id) } @@ -276,6 +282,9 @@ func (self *ethProtocol) handle() error { if err := msg.Decode(&request); err != nil { return self.protoError(ErrDecode, "%v: %v", msg, err) } + if err := request.Block.ValidateFields(); err != nil { + return self.protoError(ErrDecode, "block validation %v: %v", msg, err) + } hash := request.Block.Hash() _, chainHead, _ := self.chainManager.Status() |