jcs
/subtext
/amendments
/208
chat: Use session_output instead of printf when printing a bar
These can be big and trigger an overflow panic in the printf buffer
jcs made amendment 208 over 2 years ago
--- chat.c Thu Jun 23 10:48:11 2022
+++ chat.c Fri Jul 15 21:50:23 2022
@@ -146,7 +146,7 @@ chat_printf_line(struct session *s, short around_bar,
void
chat_start(struct session *s, char *with_node)
{
- char *input;
+ char *input, *bar;
short len, alen, lagged = 0;
s->chatting = 1;
@@ -172,7 +172,9 @@ chat_start(struct session *s, char *with_node)
" [ %s ] [ Chatting with %s ]",
s->user ? s->user->username : "guest",
s->chatting_with_node[0] ? "..." : "everyone");
- session_printf(s, "%s\r\n", session_bar(s, chat_tbuf, NULL));
+ bar = session_bar(s, chat_tbuf, NULL);
+ session_output(s, bar, strlen(bar));
+ session_output(s, "\r\n", 2);
session_flush(s);
snprintf(chat_tbuf, sizeof(chat_tbuf),