commit 8aad677bb7542376b053ecd12a0c6943e8cfa3c0 Author: Robert Ransom rransom.8774@gmail.com Date: Thu Jun 23 15:16:25 2011 -0700
Die if tor_vasprintf fails in connection_printf_to_buf
tor_asprintf already asserts if it fails. --- changes/bug3428b | 9 +++++++++ src/or/control.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/changes/bug3428b b/changes/bug3428b new file mode 100644 index 0000000..2cdd688 --- /dev/null +++ b/changes/bug3428b @@ -0,0 +1,9 @@ + o Minor bugfixes: + - Abort if tor_vasprintf fails in connection_printf_to_buf (a + utility function used in the control-port code). This shouldn't + ever happen unless Tor is completely out of memory, but if it + had happened and Tor somehow recovered from it, Tor could have + sent a log message to a control port in the middle of a reply to + a controller command. Fixes part of bug 3428. + + diff --git a/src/or/control.c b/src/or/control.c index 853f4c4..513e968 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -503,8 +503,8 @@ connection_printf_to_buf(control_connection_t *conn, const char *format, ...) va_end(ap);
if (len < 0) { - log_warn(LD_BUG, "Unable to format string for controller."); - return; + log_err(LD_BUG, "Unable to format string for controller."); + tor_assert(0); }
connection_write_to_buf(buf, (size_t)len, TO_CONN(conn));