diff options
author | ulfvonbelow <strilen@tilde.club> | 2023-01-29 05:49:49 -0600 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2023-02-06 14:12:17 +0900 |
commit | 76a3a328b726bef62d4ae767fc19f61f52ebbb67 (patch) | |
tree | 41073daa0a41533a11189863afd976dbd6ef494e | |
parent | ded7050ae2b79c1a2d50a2928e96208cfc56f0a9 (diff) | |
download | gnunet-76a3a328b726bef62d4ae767fc19f61f52ebbb67.tar.gz gnunet-76a3a328b726bef62d4ae767fc19f61f52ebbb67.zip |
REVOCATION: don't leak signature purpose memory.
Signed-off-by: Martin Schanzenbach <schanzen@gnunet.org>
-rw-r--r-- | src/revocation/revocation_api.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index a0813ddcd..327b03494 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c | |||
@@ -427,20 +427,18 @@ check_signature_identity (const struct GNUNET_REVOCATION_PowP *pow, | |||
427 | struct GNUNET_REVOCATION_SignaturePurposePS *spurp; | 427 | struct GNUNET_REVOCATION_SignaturePurposePS *spurp; |
428 | unsigned char *sig; | 428 | unsigned char *sig; |
429 | size_t ksize; | 429 | size_t ksize; |
430 | int ret; | ||
430 | 431 | ||
431 | ksize = GNUNET_IDENTITY_public_key_get_length (key); | 432 | ksize = GNUNET_IDENTITY_public_key_get_length (key); |
432 | spurp = REV_create_signature_message (pow); | 433 | spurp = REV_create_signature_message (pow); |
433 | sig = ((unsigned char*) &pow[1] + ksize); | 434 | sig = ((unsigned char*) &pow[1] + ksize); |
434 | if (GNUNET_OK != | 435 | ret = |
435 | GNUNET_IDENTITY_signature_verify_raw_ ( | 436 | GNUNET_IDENTITY_signature_verify_raw_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION, |
436 | GNUNET_SIGNATURE_PURPOSE_REVOCATION, | 437 | &spurp->purpose, |
437 | &spurp->purpose, | 438 | sig, |
438 | sig, | 439 | key); |
439 | key)) | 440 | GNUNET_free (spurp); |
440 | { | 441 | return ret == GNUNET_OK ? GNUNET_OK : GNUNET_SYSERR; |
441 | return GNUNET_SYSERR; | ||
442 | } | ||
443 | return GNUNET_OK; | ||
444 | } | 442 | } |
445 | 443 | ||
446 | 444 | ||
@@ -588,6 +586,7 @@ sign_pow_identity (const struct GNUNET_IDENTITY_PrivateKey *key, | |||
588 | int result = GNUNET_IDENTITY_sign_raw_ (key, | 586 | int result = GNUNET_IDENTITY_sign_raw_ (key, |
589 | &rp->purpose, | 587 | &rp->purpose, |
590 | (void*) sig); | 588 | (void*) sig); |
589 | GNUNET_free (rp); | ||
591 | if (result == GNUNET_SYSERR) | 590 | if (result == GNUNET_SYSERR) |
592 | return GNUNET_NO; | 591 | return GNUNET_NO; |
593 | else | 592 | else |