Commit 15e0093e authored by obscuren's avatar obscuren

Fixed issue where the client could crash when sending malformed data

parent 99797858
...@@ -450,9 +450,11 @@ func (p *Peer) HandleInbound() { ...@@ -450,9 +450,11 @@ func (p *Peer) HandleInbound() {
//ethutil.Config.Log.Debugf("[PEER] Could not find a similar block") //ethutil.Config.Log.Debugf("[PEER] Could not find a similar block")
// If no blocks are found we send back a reply with msg not in chain // If no blocks are found we send back a reply with msg not in chain
// and the last hash from get chain // and the last hash from get chain
lastHash := msg.Data.Get(l - 1) if l > 0 {
//log.Printf("Sending not in chain with hash %x\n", lastHash.AsRaw()) lastHash := msg.Data.Get(l - 1)
p.QueueMessage(ethwire.NewMessage(ethwire.MsgNotInChainTy, []interface{}{lastHash.Raw()})) //log.Printf("Sending not in chain with hash %x\n", lastHash.AsRaw())
p.QueueMessage(ethwire.NewMessage(ethwire.MsgNotInChainTy, []interface{}{lastHash.Raw()}))
}
} }
case ethwire.MsgNotInChainTy: case ethwire.MsgNotInChainTy:
ethutil.Config.Log.Debugf("Not in chain: %x\n", msg.Data.Get(0).Bytes()) ethutil.Config.Log.Debugf("Not in chain: %x\n", msg.Data.Get(0).Bytes())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment