pidgin/pidgin

Parents cda0ef7d24fb
Children 2a3cb906d0c2
Fix potential utf8 truncation on incoming invites (may result in crashes)

Reported by Joseph Bisch
--- a/libpurple/server.c Thu Mar 01 20:38:21 2018 -0600
+++ b/libpurple/server.c Mon Mar 05 04:40:33 2018 -0300
@@ -790,7 +790,6 @@
const char *who, const char *message, GHashTable *data)
{
PurpleAccount *account;
- char buf2[BUF_LONG];
struct chat_invite_data *cid;
int plugin_return;
@@ -815,14 +814,16 @@
if (plugin_return == 0)
{
+ char *buf2;
+
if (message != NULL)
{
- g_snprintf(buf2, sizeof(buf2),
+ buf2 = g_strdup_printf(
_("%s has invited %s to the chat room %s:\n%s"),
who, purple_account_get_username(account), name, message);
}
else
- g_snprintf(buf2, sizeof(buf2),
+ buf2 = g_strdup_printf(
_("%s has invited %s to the chat room %s\n"),
who, purple_account_get_username(account), name);
@@ -831,6 +832,8 @@
PURPLE_DEFAULT_ACTION_NONE, account, who, NULL,
cid, G_CALLBACK(chat_invite_accept),
G_CALLBACK(chat_invite_reject));
+
+ g_free(buf2);
}
else if (plugin_return > 0)
chat_invite_accept(cid);