Skip to content

Commit

Permalink
[node] Patch for panic on slice out of bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
rhazberries authored and Leo Chen committed May 3, 2020
1 parent 6e4db00 commit 7a07e60
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions node/node_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ func (node *Node) receiveGroupMessage(
}
//utils.Logger().Info("[PUBSUB]", "received group msg", len(msg), "sender", sender)
// skip the first 5 bytes, 1 byte is p2p type, 4 bytes are message size
if len(msg) < 5 {
continue
}
if err := rxQueue.AddMessage(msg[5:], sender); err != nil {
utils.Logger().Warn().Err(err).
Str("sender", sender.Pretty()).
Expand Down

0 comments on commit 7a07e60

Please sign in to comment.