diff options
author | Gary Kramlich <grim@reaperworld.com> | 2018-03-06 06:14:26 +0000 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2018-03-06 06:14:26 +0000 |
commit | aaa069a0d50346973b68de62976f1679c9bbbcb6 (patch) | |
tree | 3eb84d45eb58fd409ea07cb12a2528cd0400e4ad | |
parent | 327ac5af43ad4ce39465a4872f01b353a1a81870 (diff) | |
parent | f5f985d78122be95499fccbd24740c9e7fc508e7 (diff) | |
download | pidgin-aaa069a0d50346973b68de62976f1679c9bbbcb6.tar.gz |
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 <grim@reaperworld.com>
-rw-r--r-- | libpurple/server.c | 9 |
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); |