From 3dc6ee9a5be7af87f8e25b4dc61fd06572e3b979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?=
Date: Sat, 31 Oct 2020 23:25:08 +0100 Subject: [PATCH] degesch: sanitize IRC nicknames/channel names Don't trust the IRCd to have them in a subset of UTF-8. --- degesch.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/degesch.c b/degesch.c index 8c035c6..71f2931 100644 --- a/degesch.c +++ b/degesch.c @@ -4497,8 +4497,9 @@ irc_get_or_make_user_buffer (struct server *s, const char *nickname) // Open a new buffer for the user buffer = buffer_new (s->ctx->input); buffer->type = BUFFER_PM; - // FIXME: this probably needs to be converted to UTF-8 - buffer->name = xstrdup_printf ("%s.%s", s->name, nickname); + char *nickname_utf8 = irc_to_utf8 (nickname); + buffer->name = xstrdup_printf ("%s.%s", s->name, nickname_utf8); + free (nickname_utf8); buffer->server = s; buffer->user = user; str_map_set (&s->irc_buffer_map, user->nickname, buffer); @@ -6645,8 +6646,9 @@ irc_handle_join (struct server *s, const struct irc_message *msg) buffer = buffer_new (s->ctx->input); buffer->type = BUFFER_CHANNEL; - // FIXME: this probably needs to be converted to UTF-8 - buffer->name = xstrdup_printf ("%s.%s", s->name, channel_name); + char *channel_name_utf8 = irc_to_utf8 (channel_name); + buffer->name = xstrdup_printf ("%s.%s", s->name, channel_name_utf8); + free (channel_name_utf8); buffer->server = s; buffer->channel = channel = irc_make_channel (s, xstrdup (channel_name));