From 676b8394265ee96d530929154ebd808b89fc9d78 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Mon, 30 Nov 2026 00:00:15 +0100 Subject: [PATCH] Use strtok_r when wrapping chat text --- irc9.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/irc9.c b/irc9.c index 63fa3f7..8c13613 100644 --- a/irc9.c +++ b/irc9.c @@ -2507,7 +2507,9 @@ static void push_wrapped(char **rows, int *nr, int maxrows, const char *s, int w int curvis = 0; cur[0] = 0; - for (char *tok = strtok(copy, " \t"); tok; tok = strtok(NULL, " \t")) { + char *save = NULL; + for (char *tok = strtok_r(copy, " \t", &save); tok; + tok = strtok_r(NULL, " \t", &save)) { int tlvis = ircfmt_vislen(tok); size_t tlbytes = strlen(tok); if (curvis == 0) {