Commit 1f163fcb authored by Nick Mathewson's avatar Nick Mathewson 🐛
Browse files

Change BUG() messages in buf_flush_to_tls() to IF_BUG_ONCE()

We introduced these BUG() checks in b0ddaac0 to prevent a
recurrence of bug 23690.  But there's a report of the BUG() message
getting triggered and filling up the disk.  Let's change it to

Fixes bug 33093; bugfix on
parent 19954cff
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
......@@ -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;
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;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment