teamnsrg / ethereum-p2p

Official Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
17 stars 9 forks source link

bug fix #7

Closed SimonSK closed 6 years ago

SimonSK commented 6 years ago

check if message code is valid

SimonSK commented 6 years ago

https://github.com/teamnsrg/go-ethereum/pull/7#pullrequestreview-91342615 @zzma

You should also make similar changes to eth/handler.go:328 and rlpx.go:163

that one seems fine as it has to be a StatusMsg case msg.Code == StatusMsg: log.Proto("<<UNEXPECTED_"+ethCodeToString[msg.Code], "obj", "<OMITTED>", "size", int(msg.Size), "peer", p.ID())

SimonSK commented 6 years ago

I was also a bit concerned about eth/peer.go:272, but i think only eth messages should land in this function as the devp2p layer (p2p/peer.go:328) should only pass eth messages. should i still do similar safe checking?

zzma commented 6 years ago

That should be fine then! LGTM