From 27e20d6f44ec4e0ab194fed53bcdaa01b005a9bc Mon Sep 17 00:00:00 2001 From: jfreegman Date: Fri, 26 Nov 2021 18:57:40 -0500 Subject: [PATCH] Fix possible buffer overrun in python API --- src/api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api.c b/src/api.c index 866dcba..c2c2b4a 100644 --- a/src/api.c +++ b/src/api.c @@ -106,7 +106,7 @@ void api_send(const char *msg) self_window = get_active_window(); - strncpy((char *) self_window->chatwin->line, msg, sizeof(self_window->chatwin->line)); + snprintf((char *) self_window->chatwin->line, sizeof(self_window->chatwin->line), "%s", msg); add_line_to_hist(self_window->chatwin); int id = line_info_add(self_window, true, name, NULL, OUT_MSG, 0, 0, "%s", msg); cqueue_add(self_window->chatwin->cqueue, msg, strlen(msg), OUT_MSG, id);