Control port may emit log messages in the middle of another event/reply
If the following call to connection_printf_to_buf
in handle_control_getinfo
in src/or/control.c fails, it may emit a LOG
control-port event in the middle of a reply:
if (!strchr(v, '\n') && !strchr(v, '\r')) {
connection_printf_to_buf(conn, "250-%s=", k);
connection_write_str_to_buf(v, conn);
connection_write_str_to_buf("\r\n", conn);
} else {
I expect that other output functions can emit log messages in the middle of a control port event or reply, too. We should make sure that never happens, by making all control-port code build each complete reply/event in a separate buffer before writing any of it out, and adding an event/reply queue to the control_connection_t
structure.