diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-04-24 08:15:53 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-04-24 08:15:53 -0400 |
commit | 4dd4dbf046693be581dd05cdae1c62e68472d18e (patch) | |
tree | 1c92656beb6321ae5d6fe91239c8553fea815de4 /src/lib/tls | |
parent | 7f9eaec538b7d01e0d1b130dc4cf2ec634252d46 (diff) | |
parent | 64a934ff05575d63401fcdfdc6363df32191106c (diff) | |
download | tor-4dd4dbf046693be581dd05cdae1c62e68472d18e.tar.gz tor-4dd4dbf046693be581dd05cdae1c62e68472d18e.zip |
Merge remote-tracking branch 'onionk/inbufoverflow1-043' into ticket33131_044
Diffstat (limited to 'src/lib/tls')
-rw-r--r-- | src/lib/tls/buffers_tls.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/tls/buffers_tls.c b/src/lib/tls/buffers_tls.c index 87055744a7..b92a14d6a1 100644 --- a/src/lib/tls/buffers_tls.c +++ b/src/lib/tls/buffers_tls.c @@ -68,9 +68,9 @@ buf_read_from_tls(buf_t *buf, tor_tls_t *tls, size_t at_most) check_no_tls_errors(); - IF_BUG_ONCE(buf->datalen >= INT_MAX) + IF_BUG_ONCE(buf->datalen > BUF_MAX_LEN) return TOR_TLS_ERROR_MISC; - IF_BUG_ONCE(buf->datalen >= INT_MAX - at_most) + IF_BUG_ONCE(buf->datalen > BUF_MAX_LEN - at_most) return TOR_TLS_ERROR_MISC; while (at_most > total_read) { @@ -90,7 +90,7 @@ buf_read_from_tls(buf_t *buf, tor_tls_t *tls, size_t at_most) r = read_to_chunk_tls(buf, chunk, tls, readlen); if (r < 0) return r; /* Error */ - tor_assert(total_read+r < INT_MAX); + tor_assert(total_read+r <= BUF_MAX_LEN); total_read += r; if ((size_t)r < readlen) /* eof, block, or no more to read. */ break; @@ -177,6 +177,6 @@ buf_flush_to_tls(buf_t *buf, tor_tls_t *tls, size_t flushlen, if (r == 0) /* Can't flush any more now. */ break; } while (sz > 0); - tor_assert(flushed < INT_MAX); + tor_assert(flushed <= BUF_MAX_LEN); return (int)flushed; } |