summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordx <dx@dxzone.com.ar>2018-03-05 04:40:33 -0300
committerdx <dx@dxzone.com.ar>2018-03-05 04:40:33 -0300
commitf5f985d78122be95499fccbd24740c9e7fc508e7 (patch)
tree226dcc5624eb02b42fd6670567580dbec5b24ddd
parentfc148f2fe97668f951969280066684b9175d8e4b (diff)
downloadpidgin-f5f985d78122be95499fccbd24740c9e7fc508e7.tar.gz
Fix potential utf8 truncation on incoming invites (may result in crashes)
Reported by Joseph Bisch
-rw-r--r--libpurple/server.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libpurple/server.c b/libpurple/server.c
index 27a796ffef..e865ec7afb 100644
--- a/libpurple/server.c
+++ b/libpurple/server.c
@@ -790,7 +790,6 @@ void serv_got_chat_invite(PurpleConnection *gc, const char *name,
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 @@ void serv_got_chat_invite(PurpleConnection *gc, const char *name,
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 @@ void serv_got_chat_invite(PurpleConnection *gc, const char *name,
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);