diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-12-25 22:43:01 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-01-03 11:29:49 -0500 |
commit | d3de0b91fb322c00d11857d89a8420af0d466e39 (patch) | |
tree | 1c33f8f2126db0ede938cbff1d5a111640cf167d /src/or/onion_fast.c | |
parent | 94cb7bd24d2ffda9038c267b3ee0837dd64ec903 (diff) | |
download | tor-d3de0b91fb322c00d11857d89a8420af0d466e39.tar.gz tor-d3de0b91fb322c00d11857d89a8420af0d466e39.zip |
Check all crypto_rand return values for ntor.
Diffstat (limited to 'src/or/onion_fast.c')
-rw-r--r-- | src/or/onion_fast.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/or/onion_fast.c b/src/or/onion_fast.c index eb9eceba88..c1a05233e0 100644 --- a/src/or/onion_fast.c +++ b/src/or/onion_fast.c @@ -29,8 +29,11 @@ fast_onionskin_create(fast_handshake_state_t **handshake_state_out, uint8_t *handshake_out) { fast_handshake_state_t *s; - *handshake_state_out = s =tor_malloc(sizeof(fast_handshake_state_t)); - crypto_rand((char*)s->state, sizeof(s->state)); + *handshake_state_out = s = tor_malloc(sizeof(fast_handshake_state_t)); + if (crypto_rand((char*)s->state, sizeof(s->state)) < 0) { + tor_free(s); + return -1; + } memcpy(handshake_out, s->state, DIGEST_LEN); return 0; } |