diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2021-05-15 20:26:44 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2021-05-15 20:26:44 +0200 |
commit | c2cd7ec031ff925294b5c4c0c992fe9014846430 (patch) | |
tree | 9f247d89e321f1323a5276f9bba926eec7ab1b06 /src/revocation/plugin_block_revocation.c | |
parent | 6d40171315d344d8a62d611df200d43f1fefc238 (diff) | |
download | gnunet-c2cd7ec031ff925294b5c4c0c992fe9014846430.tar.gz gnunet-c2cd7ec031ff925294b5c4c0c992fe9014846430.zip |
-coverity: handle invalid key length
Diffstat (limited to 'src/revocation/plugin_block_revocation.c')
-rw-r--r-- | src/revocation/plugin_block_revocation.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/revocation/plugin_block_revocation.c b/src/revocation/plugin_block_revocation.c index 1928d09cd..da5882d59 100644 --- a/src/revocation/plugin_block_revocation.c +++ b/src/revocation/plugin_block_revocation.c | |||
@@ -190,6 +190,7 @@ block_plugin_revocation_get_key (void *cls, | |||
190 | struct GNUNET_HashCode *key) | 190 | struct GNUNET_HashCode *key) |
191 | { | 191 | { |
192 | const struct RevokeMessage *rm = block; | 192 | const struct RevokeMessage *rm = block; |
193 | ssize_t ksize; | ||
193 | 194 | ||
194 | if (block_size <= sizeof(*rm)) | 195 | if (block_size <= sizeof(*rm)) |
195 | { | 196 | { |
@@ -199,8 +200,14 @@ block_plugin_revocation_get_key (void *cls, | |||
199 | struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1]; | 200 | struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1]; |
200 | const struct GNUNET_IDENTITY_PublicKey *pk; | 201 | const struct GNUNET_IDENTITY_PublicKey *pk; |
201 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; | 202 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; |
203 | ksize = GNUNET_IDENTITY_key_get_length (pk); | ||
204 | if (0 > ksize) | ||
205 | { | ||
206 | GNUNET_break_op (0); | ||
207 | return GNUNET_SYSERR; | ||
208 | } | ||
202 | GNUNET_CRYPTO_hash (pk, | 209 | GNUNET_CRYPTO_hash (pk, |
203 | GNUNET_IDENTITY_key_get_length (pk), | 210 | ksize, |
204 | key); | 211 | key); |
205 | return GNUNET_OK; | 212 | return GNUNET_OK; |
206 | } | 213 | } |