Fixed issue where the client could crash when sending malformed data

pull/150/head
obscuren 11 years ago
parent 99797858a6
commit 15e0093e13
  1. 2
      peer.go

@ -450,10 +450,12 @@ 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
if l > 0 {
lastHash := msg.Data.Get(l - 1) lastHash := msg.Data.Get(l - 1)
//log.Printf("Sending not in chain with hash %x\n", lastHash.AsRaw()) //log.Printf("Sending not in chain with hash %x\n", lastHash.AsRaw())
p.QueueMessage(ethwire.NewMessage(ethwire.MsgNotInChainTy, []interface{}{lastHash.Raw()})) 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())
if p.diverted == true { if p.diverted == true {

Loading…
Cancel
Save