commit b9d71f3848a2858dc0a3c5232c85d97525aacd25
parent add387c5071a1ee7889e3789e7b4143bb8856d0a
Author: Nick Mathewson <nickm@torproject.org>
Date: Fri, 13 Mar 2020 16:46:09 -0400
Merge remote-tracking branch 'tor-github/pr/1693/head' into maint-0.3.5
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/changes/bug33093_logging b/changes/bug33093_logging
@@ -0,0 +1,5 @@
+ o Minor bugfixes (logging):
+ - If we encounter a bug when flushing a buffer to a TLS connection,
+ only log the bug once per invocation of the Tor process. Previously we
+ would log with every occurrence, which could cause us to run out of
+ disk space. Fixes bug 33093; bugfix on 0.3.2.2-alpha.
diff --git a/src/lib/tls/buffers_tls.c b/src/lib/tls/buffers_tls.c
@@ -146,10 +146,10 @@ buf_flush_to_tls(buf_t *buf, tor_tls_t *tls, size_t flushlen,
size_t flushed = 0;
ssize_t sz;
tor_assert(buf_flushlen);
- if (BUG(*buf_flushlen > buf->datalen)) {
+ IF_BUG_ONCE(*buf_flushlen > buf->datalen) {
*buf_flushlen = buf->datalen;
}
- if (BUG(flushlen > *buf_flushlen)) {
+ IF_BUG_ONCE(flushlen > *buf_flushlen) {
flushlen = *buf_flushlen;
}
sz = (ssize_t) flushlen;