From: Florian Dold Date: Sun, 26 Feb 2017 22:12:40 +0000 (+0100) Subject: fix warning / add size validation for consensus block X-Git-Tag: taler-0.2.1~22 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cc8f37a834298d95c233769d19eb9cd17e3dbcfd;p=oweals%2Fgnunet.git fix warning / add size validation for consensus block --- 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; }