From cc8f37a834298d95c233769d19eb9cd17e3dbcfd Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 26 Feb 2017 23:12:40 +0100 Subject: [PATCH] fix warning / add size validation for consensus block --- src/consensus/consensus_protocol.h | 1 + src/consensus/plugin_block_consensus.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/consensus/consensus_protocol.h b/src/consensus/consensus_protocol.h index 101b8aee7..161c939cd 100644 --- a/src/consensus/consensus_protocol.h +++ b/src/consensus/consensus_protocol.h @@ -29,6 +29,7 @@ #define GNUNET_CONSENSUS_PROTOCOL_H #include "platform.h" +#include "gnunet_util_lib.h" #include "gnunet_common.h" #include "gnunet_protocols.h" diff --git a/src/consensus/plugin_block_consensus.c b/src/consensus/plugin_block_consensus.c index 399e85feb..39e348b18 100644 --- a/src/consensus/plugin_block_consensus.c +++ b/src/consensus/plugin_block_consensus.c @@ -25,6 +25,7 @@ */ #include "platform.h" +#include "consensus_protocol.h" #include "gnunet_block_plugin.h" #include "gnunet_block_group_lib.h" @@ -55,6 +56,10 @@ block_plugin_consensus_evaluate (void *cls, const void *reply_block, size_t reply_block_size) { + if (reply_block_size < sizeof (struct ConsensusElement)) + { + return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; + } return GNUNET_BLOCK_EVALUATION_OK_MORE; } -- 2.25.1