commit 55118d90ca927d2cdb2cbd92189113da4dcb2fe7 Author: Nick Mathewson nickm@torproject.org Date: Thu Apr 23 09:09:20 2015 -0400
Fix some implicit conversion warnings --- src/common/crypto.c | 4 +++- src/test/test_crypto.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/common/crypto.c b/src/common/crypto.c index 2cb1c39..1b45639 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -2496,6 +2496,8 @@ base64_encode(char *dest, size_t destlen, const char *src, size_t srclen, return -1; if (destlen > SIZE_T_CEILING) return -1; + if (enclen > INT_MAX) + return -1;
memset(dest, 0, enclen);
@@ -2576,7 +2578,7 @@ base64_encode(char *dest, size_t destlen, const char *src, size_t srclen,
*d++ = '\0'; /* NUL terminate the output. */
- return enclen; + return (int) enclen; }
#undef BASE64_OPENSSL_LINELEN diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c index 299373e..7f4aa13 100644 --- a/src/test/test_crypto.c +++ b/src/test/test_crypto.c @@ -614,7 +614,7 @@ base64_encode_evp(char *dest, char *src, size_t srclen) int len, ret;
EVP_EncodeInit(&ctx); - EVP_EncodeUpdate(&ctx, (unsigned char *)dest, &len, s, srclen); + EVP_EncodeUpdate(&ctx, (unsigned char *)dest, &len, s, (int)srclen); EVP_EncodeFinal(&ctx, (unsigned char *)(dest + len), &ret); return ret+ len; }