diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-30 12:18:47 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-30 12:18:47 +0000 |
commit | 079d2f0b130d3f6e830a4d8567f43e03782ae2cb (patch) | |
tree | e7d58d865e257c93663ff41921ec3cc624922897 /src | |
parent | 862d9416e6e4fc2bd493d5c89a58187218fe4e51 (diff) | |
download | gnunet-079d2f0b130d3f6e830a4d8567f43e03782ae2cb.tar.gz gnunet-079d2f0b130d3f6e830a4d8567f43e03782ae2cb.zip |
-fix use after free
Diffstat (limited to 'src')
-rw-r--r-- | src/util/test_crypto_rsa.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util/test_crypto_rsa.c b/src/util/test_crypto_rsa.c index 156d40ed4..3b2731528 100644 --- a/src/util/test_crypto_rsa.c +++ b/src/util/test_crypto_rsa.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2014 Christian Grothoff (and other contributing authors) | 3 | (C) 2014,2015 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify it under the | 5 | GNUnet is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU General Public License as published by the Free Software | 6 | terms of the GNU General Public License as published by the Free Software |
@@ -55,14 +55,13 @@ main (int argc, | |||
55 | enc = NULL; | 55 | enc = NULL; |
56 | size = GNUNET_CRYPTO_rsa_private_key_encode (priv, &enc); | 56 | size = GNUNET_CRYPTO_rsa_private_key_encode (priv, &enc); |
57 | GNUNET_free (enc); | 57 | GNUNET_free (enc); |
58 | 58 | ||
59 | /* try ordinary sig first */ | 59 | /* try ordinary sig first */ |
60 | sig = GNUNET_CRYPTO_rsa_sign (priv, | 60 | sig = GNUNET_CRYPTO_rsa_sign (priv, |
61 | &hash, | 61 | &hash, |
62 | sizeof (hash)); | 62 | sizeof (hash)); |
63 | GNUNET_assert (GNUNET_OK == | 63 | GNUNET_assert (GNUNET_OK == |
64 | GNUNET_CRYPTO_rsa_verify (&hash, sig, pub)); | 64 | GNUNET_CRYPTO_rsa_verify (&hash, sig, pub)); |
65 | GNUNET_CRYPTO_rsa_signature_free (sig); | ||
66 | /* corrupt our hash and see if the signature is still valid */ | 65 | /* corrupt our hash and see if the signature is still valid */ |
67 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &hash, | 66 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &hash, |
68 | sizeof (struct GNUNET_HashCode)); | 67 | sizeof (struct GNUNET_HashCode)); |
@@ -70,6 +69,7 @@ main (int argc, | |||
70 | sig, | 69 | sig, |
71 | pub)); | 70 | pub)); |
72 | (void) fprintf (stderr, "The above warning is expected.\n"); | 71 | (void) fprintf (stderr, "The above warning is expected.\n"); |
72 | GNUNET_CRYPTO_rsa_signature_free (sig); | ||
73 | 73 | ||
74 | 74 | ||
75 | /* test blind signing */ | 75 | /* test blind signing */ |