Die if tor_vasprintf fails in connection_printf_to_buf

tor_asprintf already asserts if it fails.
This commit is contained in:
Robert Ransom 2011-06-23 15:16:25 -07:00 committed by Nick Mathewson
parent b70a0a4375
commit 8aad677bb7
2 changed files with 11 additions and 2 deletions

9
changes/bug3428b Normal file
View File

@ -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.

View File

@ -503,8 +503,8 @@ connection_printf_to_buf(control_connection_t *conn, const char *format, ...)
va_end(ap); va_end(ap);
if (len < 0) { if (len < 0) {
log_warn(LD_BUG, "Unable to format string for controller."); log_err(LD_BUG, "Unable to format string for controller.");
return; tor_assert(0);
} }
connection_write_to_buf(buf, (size_t)len, TO_CONN(conn)); connection_write_to_buf(buf, (size_t)len, TO_CONN(conn));