Mercurial > pidgin
changeset 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 | 15e80ced77a2 |
children | ca4714f51bb1 d6cc1ff0d9b7 |
files | ChangeLog libpurple/protocols/irc/parse.c |
diffstat | 2 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Oct 31 01:22:26 2011 +0000 +++ b/ChangeLog Tue Nov 29 03:58:50 2011 +0000 @@ -7,6 +7,10 @@ Gadu-Gadu: * Fix problems linking against GnuTLS. (#14544) + IRC: + * Fix a leak when admitting UTF-8 text with a non-UTF-8 primary + encoding. (#14700) + Sametime: * Separate "username" and "server" when adding new Sametime accounts. (#14608)
--- 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 == ' ')