aboutsummaryrefslogtreecommitdiff
path: root/src/consensus
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-02-26 23:12:40 +0100
committerFlorian Dold <florian.dold@gmail.com>2017-02-26 23:12:40 +0100
commitcc8f37a834298d95c233769d19eb9cd17e3dbcfd (patch)
tree43c926c0025037b1016ef7f6e9ab87fbd34e3e44 /src/consensus
parente2b2ab728217a64027232c7b8fbbb68ba13edd4a (diff)
downloadgnunet-cc8f37a834298d95c233769d19eb9cd17e3dbcfd.tar.gz
gnunet-cc8f37a834298d95c233769d19eb9cd17e3dbcfd.zip
fix warning / add size validation for consensus block
Diffstat (limited to 'src/consensus')
-rw-r--r--src/consensus/consensus_protocol.h1
-rw-r--r--src/consensus/plugin_block_consensus.c5
2 files changed, 6 insertions, 0 deletions
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 @@
29#define GNUNET_CONSENSUS_PROTOCOL_H 29#define GNUNET_CONSENSUS_PROTOCOL_H
30 30
31#include "platform.h" 31#include "platform.h"
32#include "gnunet_util_lib.h"
32#include "gnunet_common.h" 33#include "gnunet_common.h"
33#include "gnunet_protocols.h" 34#include "gnunet_protocols.h"
34 35
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 @@
25 */ 25 */
26 26
27#include "platform.h" 27#include "platform.h"
28#include "consensus_protocol.h"
28#include "gnunet_block_plugin.h" 29#include "gnunet_block_plugin.h"
29#include "gnunet_block_group_lib.h" 30#include "gnunet_block_group_lib.h"
30 31
@@ -55,6 +56,10 @@ block_plugin_consensus_evaluate (void *cls,
55 const void *reply_block, 56 const void *reply_block,
56 size_t reply_block_size) 57 size_t reply_block_size)
57{ 58{
59 if (reply_block_size < sizeof (struct ConsensusElement))
60 {
61 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
62 }
58 return GNUNET_BLOCK_EVALUATION_OK_MORE; 63 return GNUNET_BLOCK_EVALUATION_OK_MORE;
59} 64}
60 65