pidgin/pidgin

2a3cb906d0c2
Merged in dequisdequis/security/release-2.x.y (pull request #24)

Fix potential utf8 truncation on incoming invites (may result in crashes)

Approved-by: Gary Kramlich
--- a/libpurple/server.c Mon Mar 05 03:44:04 2018 -0300
+++ b/libpurple/server.c Tue Mar 06 06:14:26 2018 +0000
@@ -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);