summaryrefslogtreecommitdiff
path: root/src/lib/crypt_ops/crypto_rsa.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-09-13 17:49:36 -0400
committerNick Mathewson <nickm@torproject.org>2018-09-13 17:49:39 -0400
commit92357a07bd7e695def1b2416d3a85b5f10e4e196 (patch)
tree1922fc29c25a11dbb368db7c263da818952e01f2 /src/lib/crypt_ops/crypto_rsa.c
parent83b8a76f0c246bde442f36681a59a735896110cd (diff)
downloadtor-92357a07bd7e695def1b2416d3a85b5f10e4e196.tar.gz
tor-92357a07bd7e695def1b2416d3a85b5f10e4e196.zip
Fix a 32-bit off_t/size_t warning in crypto_rsa.c
Bug not in any released Tor.
Diffstat (limited to 'src/lib/crypt_ops/crypto_rsa.c')
-rw-r--r--src/lib/crypt_ops/crypto_rsa.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/crypt_ops/crypto_rsa.c b/src/lib/crypt_ops/crypto_rsa.c
index 6a9e2948f1..567b4531ae 100644
--- a/src/lib/crypt_ops/crypto_rsa.c
+++ b/src/lib/crypt_ops/crypto_rsa.c
@@ -551,9 +551,12 @@ 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 > SSIZE_MAX)
+ return -1;
- int rv = crypto_pk_read_private_key_from_string(env, buf, st.st_size);
- memwipe(buf, 0, st.st_size);
+ int rv = crypto_pk_read_private_key_from_string(env, buf,
+ (ssize_t)st.st_size);
+ memwipe(buf, 0, (size_t)st.st_size);
tor_free(buf);
return rv;
}