diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-02-21 21:57:47 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-02-21 21:57:47 +0000 |
commit | 69300eb606732a35eff5c2e150cf71667df59d3f (patch) | |
tree | 9f8f1f062957ed8812fa023ab72724d004459f6b /src/common/tortls.c | |
parent | b375472d14cb9165e3acab899e4388a36c03bf25 (diff) | |
download | tor-69300eb606732a35eff5c2e150cf71667df59d3f.tar.gz tor-69300eb606732a35eff5c2e150cf71667df59d3f.zip |
r14374@tombo: nickm | 2008-02-21 16:57:39 -0500
Fix all remaining shorten-64-to-32 errors in src/common. Some were genuine problems. Many were compatibility errors with libraries (openssl, zlib) that like predate size_t. Partial backport candidate.
svn:r13665
Diffstat (limited to 'src/common/tortls.c')
-rw-r--r-- | src/common/tortls.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c index 2918ab288e..8690231e65 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -111,7 +111,7 @@ static INLINE unsigned int tor_tls_entry_hash(const tor_tls_t *a) { #if SIZEOF_INT == SIZEOF_VOID_P - return ((unsigned int)a->ssl); + return ((unsigned int)(uintptr_t)a->ssl); #else return (unsigned int) ((((uint64_t)a->ssl)>>2) & UINT_MAX); #endif @@ -162,7 +162,7 @@ static int tls_library_is_initialized = 0; static void tls_log_errors(tor_tls_t *tls, int severity, const char *doing) { - int err; + unsigned long err; const char *msg, *lib, *func, *addr; addr = tls ? tls->address : NULL; while ((err = ERR_get_error()) != 0) { @@ -841,7 +841,8 @@ tor_tls_read(tor_tls_t *tls, char *cp, size_t len) tor_assert(tls); tor_assert(tls->ssl); tor_assert(tls->state == TOR_TLS_ST_OPEN); - r = SSL_read(tls->ssl, cp, len); + tor_assert(len<INT_MAX); + r = SSL_read(tls->ssl, cp, (int)len); if (r > 0) { #ifdef V2_HANDSHAKE_SERVER if (tls->got_renegotiate) { @@ -878,6 +879,7 @@ tor_tls_write(tor_tls_t *tls, const char *cp, size_t n) tor_assert(tls); tor_assert(tls->ssl); tor_assert(tls->state == TOR_TLS_ST_OPEN); + tor_assert(n < INT_MAX); if (n == 0) return 0; if (tls->wantwrite_n) { @@ -888,7 +890,7 @@ tor_tls_write(tor_tls_t *tls, const char *cp, size_t n) n = tls->wantwrite_n; tls->wantwrite_n = 0; } - r = SSL_write(tls->ssl, cp, n); + r = SSL_write(tls->ssl, cp, (int)n); err = tor_tls_get_error(tls, r, 0, "writing", LOG_INFO); if (err == TOR_TLS_DONE) { return r; |