diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-02-26 23:12:40 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-02-26 23:12:40 +0100 |
commit | cc8f37a834298d95c233769d19eb9cd17e3dbcfd (patch) | |
tree | 43c926c0025037b1016ef7f6e9ab87fbd34e3e44 /src/consensus | |
parent | e2b2ab728217a64027232c7b8fbbb68ba13edd4a (diff) |
fix warning / add size validation for consensus block
Diffstat (limited to 'src/consensus')
-rw-r--r-- | src/consensus/consensus_protocol.h | 1 | ||||
-rw-r--r-- | src/consensus/plugin_block_consensus.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/consensus/consensus_protocol.h b/src/consensus/consensus_protocol.h index 101b8aee7b..161c939cdd 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 399e85feb4..39e348b18e 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; } |