diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2021-05-15 20:20:48 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2021-05-15 20:20:48 +0200 |
commit | 6d40171315d344d8a62d611df200d43f1fefc238 (patch) | |
tree | fb6317bccbda0a259718eaf085431ec30f91f9b4 /src/revocation/gnunet-revocation.c | |
parent | 05dc002ec4f5396b5633fcf686cd4cd2d06ae776 (diff) | |
download | gnunet-6d40171315d344d8a62d611df200d43f1fefc238.tar.gz gnunet-6d40171315d344d8a62d611df200d43f1fefc238.zip |
-coverity: handle invalid key length
Diffstat (limited to 'src/revocation/gnunet-revocation.c')
-rw-r--r-- | src/revocation/gnunet-revocation.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index 99fecdd35..a7f96385c 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c | |||
@@ -343,7 +343,13 @@ ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
343 | GNUNET_DISK_fn_read (filename, proof_of_work, | 343 | GNUNET_DISK_fn_read (filename, proof_of_work, |
344 | GNUNET_REVOCATION_MAX_PROOF_SIZE)))) | 344 | GNUNET_REVOCATION_MAX_PROOF_SIZE)))) |
345 | { | 345 | { |
346 | size_t ksize = GNUNET_IDENTITY_key_get_length (&key); | 346 | ssize_t ksize = GNUNET_IDENTITY_key_get_length (&key); |
347 | if (0 > ksize) | ||
348 | { | ||
349 | fprintf (stderr, | ||
350 | _ ("Error: Key is invalid\n")); | ||
351 | return; | ||
352 | } | ||
347 | if (((psize - sizeof (*proof_of_work)) < ksize) || // Key too small | 353 | if (((psize - sizeof (*proof_of_work)) < ksize) || // Key too small |
348 | (0 != memcmp (&proof_of_work[1], &key, ksize))) // Keys do not match | 354 | (0 != memcmp (&proof_of_work[1], &key, ksize))) // Keys do not match |
349 | { | 355 | { |