summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-09-18 08:10:25 -0400
committerNick Mathewson <nickm@torproject.org>2018-09-18 08:10:25 -0400
commit50001d1c5b74b40ee858781dbd35dd7d209dac5b (patch)
tree932ab3b132d9aef54da2c5f5a13ee6341a66a6b0
parent7ca0f66b8234d32657f8866da46289533dba1750 (diff)
parent43324b0e4d9835ca7bab1d8e6bc4544a708b8ea4 (diff)
downloadtor-50001d1c5b74b40ee858781dbd35dd7d209dac5b.tar.gz
tor-50001d1c5b74b40ee858781dbd35dd7d209dac5b.zip
Merge remote-tracking branch 'asn-github/bug27764'
-rw-r--r--src/lib/crypt_ops/crypto_rsa.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/crypt_ops/crypto_rsa.c b/src/lib/crypt_ops/crypto_rsa.c
index c3c6db6c31..a510e12964 100644
--- a/src/lib/crypt_ops/crypto_rsa.c
+++ b/src/lib/crypt_ops/crypto_rsa.c
@@ -554,8 +554,10 @@ crypto_pk_read_private_key_from_filename(crypto_pk_t *env,
char *buf = read_file_to_str(keyfile, 0, &st);
if (!buf)
return -1;
- if (st.st_size > MAX_PRIVKEY_FILE_LEN)
+ if (st.st_size > MAX_PRIVKEY_FILE_LEN) {
+ tor_free(buf);
return -1;
+ }
int rv = crypto_pk_read_private_key_from_string(env, buf,
(ssize_t)st.st_size);