diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-08-09 09:24:16 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-08-09 09:24:16 -0400 |
commit | 418f3d6298beb27e050618e2f59e01d6d3b2f45b (patch) | |
tree | 97ac6a038194559561a34d245fbd74584cb5f9c6 /src/or/rendclient.c | |
parent | 9696021593d28a7ae3b6a88ac57ff31234b469f5 (diff) | |
download | tor-418f3d6298beb27e050618e2f59e01d6d3b2f45b.tar.gz tor-418f3d6298beb27e050618e2f59e01d6d3b2f45b.zip |
Make sure we always wind up checking i2d_*'s output.
The biggest offender here was sometimes not checking the output of
crypto_pk_get_digest.
Fixes bug 19418. Reported by Guido Vranken.
Diffstat (limited to 'src/or/rendclient.c')
-rw-r--r-- | src/or/rendclient.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/or/rendclient.c b/src/or/rendclient.c index a93bc94a9c..e54818c543 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -263,6 +263,11 @@ rend_client_send_introduction(origin_circuit_t *introcirc, klen = crypto_pk_asn1_encode(extend_info->onion_key, tmp+v3_shift+7+DIGEST_LEN+2, sizeof(tmp)-(v3_shift+7+DIGEST_LEN+2)); + if (klen < 0) { + log_warn(LD_BUG,"Internal error: can't encode public key."); + status = -2; + goto perm_err; + } set_uint16(tmp+v3_shift+7+DIGEST_LEN, htons(klen)); memcpy(tmp+v3_shift+7+DIGEST_LEN+2+klen, rendcirc->rend_data->rend_cookie, REND_COOKIE_LEN); |