Mercurial > pidgin
diff libpurple/protocols/irc/parse.c @ 32367:00ea5f8ef509
Fix a leak in IRC when accepting a UTF-8 message with a non-UTF-8 encoding.
Fixes #14700
| author | Ethan Blanton <elb@pidgin.im> |
|---|---|
| date | Tue, 29 Nov 2011 03:58:50 +0000 |
| parents | 062f5781aa57 |
| children | ca4714f51bb1 |
line wrap: on
line diff
--- a/libpurple/protocols/irc/parse.c Mon Oct 31 01:22:26 2011 +0000 +++ b/libpurple/protocols/irc/parse.c Tue Nov 29 03:58:50 2011 +0000 @@ -260,6 +260,12 @@ gboolean autodetect; int i; + autodetect = purple_account_get_bool(irc->account, "autodetect_utf8", IRC_DEFAULT_AUTODETECT); + + if (autodetect && g_utf8_validate(string, -1, NULL)) { + return g_strdup(string); + } + enclist = purple_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET); encodings = g_strsplit(enclist, ",", -1); @@ -268,12 +274,6 @@ return purple_utf8_salvage(string); } - autodetect = purple_account_get_bool(irc->account, "autodetect_utf8", IRC_DEFAULT_AUTODETECT); - - if (autodetect && g_utf8_validate(string, -1, NULL)) { - return g_strdup(string); - } - for (i = 0; encodings[i] != NULL; i++) { charset = encodings[i]; while (*charset == ' ')
