diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2020-10-31 23:25:08 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2020-10-31 23:25:08 +0100 |
commit | 3dc6ee9a5be7af87f8e25b4dc61fd06572e3b979 (patch) | |
tree | 61372fc4e9ab431c8ea5847ee576d8fbe501d1e5 /degesch.c | |
parent | 821ce04915fa7f42fee77f626685ab983387073b (diff) | |
download | xK-3dc6ee9a5be7af87f8e25b4dc61fd06572e3b979.tar.gz xK-3dc6ee9a5be7af87f8e25b4dc61fd06572e3b979.tar.xz xK-3dc6ee9a5be7af87f8e25b4dc61fd06572e3b979.zip |
degesch: sanitize IRC nicknames/channel names
Don't trust the IRCd to have them in a subset of UTF-8.
Diffstat (limited to 'degesch.c')
-rw-r--r-- | degesch.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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)); |