tls: Log TLS read buffer length bugs once

Rather than filling the logs with similar warnings.

Fixes bug 31939; bugfix on 0.3.0.4-rc.
This commit is contained in:
teor 2019-10-04 12:33:34 +10:00
parent 7b9cb4c47b
commit ff304f3be7
No known key found for this signature in database
GPG Key ID: 10FEAA0E7075672A
2 changed files with 5 additions and 2 deletions

3
changes/bug31939 Normal file
View File

@ -0,0 +1,3 @@
o Minor bugfixes (tls, logging):
- Log TLS read buffer length bugs once, rather than filling the logs
with similar warnings. Fixes bug 31939; bugfix on 0.3.0.4-rc.

View File

@ -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(buf->datalen >= INT_MAX))
IF_BUG_ONCE(buf->datalen >= INT_MAX)
return -1;
if (BUG(buf->datalen >= INT_MAX - at_most))
IF_BUG_ONCE(buf->datalen >= INT_MAX - at_most)
return -1;
while (at_most > total_read) {