From 31d993029df984445ee54c2321976f370bc05460 Mon Sep 17 00:00:00 2001 From: dequis Date: Fri, 27 Nov 2015 21:00:42 -0300 Subject: bee_irc_user_new: Use str_reject_chars to sanitize both user and host Fixes trac ticket 1195: https://bugs.bitlbee.org/bitlbee/ticket/1195 I had no idea how to reproduce that bug until I tried with libpurple. The built-in jabber never had this problem. --- irc_im.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'irc_im.c') diff --git a/irc_im.c b/irc_im.c index fe279abe..0b0b0274 100644 --- a/irc_im.c +++ b/irc_im.c @@ -83,9 +83,9 @@ static gboolean bee_irc_user_new(bee_t *bee, bee_user_t *bu) } } - while ((s = strchr(iu->user, ' '))) { - *s = '_'; - } + /* Sanitize */ + str_reject_chars(iu->user, " ", '_'); + str_reject_chars(iu->host, " ", '_'); if (bu->flags & BEE_USER_LOCAL) { char *s = set_getstr(&bee->set, "handle_unknown"); -- cgit v1.2.3