degesch: sanitize IRC nicknames/channel names
Don't trust the IRCd to have them in a subset of UTF-8.
This commit is contained in:
parent
821ce04915
commit
3dc6ee9a5b
10
degesch.c
10
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
|
// Open a new buffer for the user
|
||||||
buffer = buffer_new (s->ctx->input);
|
buffer = buffer_new (s->ctx->input);
|
||||||
buffer->type = BUFFER_PM;
|
buffer->type = BUFFER_PM;
|
||||||
// FIXME: this probably needs to be converted to UTF-8
|
char *nickname_utf8 = irc_to_utf8 (nickname);
|
||||||
buffer->name = xstrdup_printf ("%s.%s", s->name, nickname);
|
buffer->name = xstrdup_printf ("%s.%s", s->name, nickname_utf8);
|
||||||
|
free (nickname_utf8);
|
||||||
buffer->server = s;
|
buffer->server = s;
|
||||||
buffer->user = user;
|
buffer->user = user;
|
||||||
str_map_set (&s->irc_buffer_map, user->nickname, buffer);
|
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 = buffer_new (s->ctx->input);
|
||||||
buffer->type = BUFFER_CHANNEL;
|
buffer->type = BUFFER_CHANNEL;
|
||||||
// FIXME: this probably needs to be converted to UTF-8
|
char *channel_name_utf8 = irc_to_utf8 (channel_name);
|
||||||
buffer->name = xstrdup_printf ("%s.%s", s->name, channel_name);
|
buffer->name = xstrdup_printf ("%s.%s", s->name, channel_name_utf8);
|
||||||
|
free (channel_name_utf8);
|
||||||
buffer->server = s;
|
buffer->server = s;
|
||||||
buffer->channel = channel =
|
buffer->channel = channel =
|
||||||
irc_make_channel (s, xstrdup (channel_name));
|
irc_make_channel (s, xstrdup (channel_name));
|
||||||
|
Loading…
Reference in New Issue
Block a user