Mon, 30 May 2022 20:52:30 -0500
Fix segmentation fault on IRC server reply
When Pidgin received `:nick!user@host JOIN #channel` from an IRC
server, it worked fine, but when it received
`:nick JOIN #channel`, it crashed with a segmentation fault.
Testing Done:
Tested with a custom IRC server that only sends the nickname. Also tested on Libera Chat.
Bugs closed: PIDGIN-17375
Reviewed at https://reviews.imfreedom.org/r/1484/
| libpurple/protocols/irc/msgs.c | file | annotate | diff | comparison | revisions |
--- a/libpurple/protocols/irc/msgs.c Fri May 27 03:32:41 2022 -0500 +++ b/libpurple/protocols/irc/msgs.c Mon May 30 20:52:30 2022 -0500 @@ -71,7 +71,14 @@ static char *irc_mask_userhost(const char *mask) { - return g_strdup(strchr(mask, '!') + 1); + char *sep = strchr(mask, '!'); + char *host = ""; + + if(sep) { + host = sep + 1; + } + + return g_strdup(host); } static void irc_chat_remove_buddy(PurpleConversation *convo, char *data[2])