From 1303b939e706d3d0ff009235deb1981dc0eb9b3b Mon Sep 17 00:00:00 2001 From: capossele <angelocapossele@gmail.com> Date: Tue, 21 Apr 2020 08:46:21 +0100 Subject: [PATCH] :bug: adds len check --- plugins/drng/plugin.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/drng/plugin.go b/plugins/drng/plugin.go index 5b43673e..66ca57be 100644 --- a/plugins/drng/plugin.go +++ b/plugins/drng/plugin.go @@ -5,6 +5,7 @@ import ( "github.com/iotaledger/goshimmer/packages/binary/drng" "github.com/iotaledger/goshimmer/packages/binary/drng/payload" + "github.com/iotaledger/goshimmer/packages/binary/drng/payload/header" "github.com/iotaledger/goshimmer/packages/binary/drng/state" cbPayload "github.com/iotaledger/goshimmer/packages/binary/drng/subtypes/collectiveBeacon/payload" "github.com/iotaledger/goshimmer/packages/binary/messagelayer/message" @@ -68,6 +69,9 @@ func configureEvents() { cachedMessageMetadata.Release() cachedMessage.Consume(func(msg *message.Message) { + if len(msg.Payload().Bytes()) < header.Length { + return + } marshalUtil := marshalutil.New(msg.Payload().Bytes()) parsedPayload, err := payload.Parse(marshalUtil) if err != nil { -- GitLab