diff --git a/src/ui/core.c b/src/ui/core.c index f16080a2..a12bb3ea 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -298,8 +298,12 @@ ui_contact_typing(const char *const barejid, const char *const resource) if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_TYPING_CURRENT)) ) { PContact contact = roster_get_contact(barejid); char const *display_usr = NULL; - if (p_contact_name(contact)) { - display_usr = p_contact_name(contact); + if (contact) { + if (p_contact_name(contact)) { + display_usr = p_contact_name(contact); + } else { + display_usr = barejid; + } } else { display_usr = barejid; } diff --git a/src/xmpp/message.c b/src/xmpp/message.c index 9d80fb1f..3f8ad5a0 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -714,6 +714,14 @@ _handle_carbons(xmpp_stanza_t *const stanza) return TRUE; } + Jid *my_jid = jid_create(connection_get_fulljid()); + const char *const stanza_from = xmpp_stanza_get_from(stanza); + Jid *msg_jid = jid_create(stanza_from); + if (g_strcmp0(my_jid->barejid, msg_jid->barejid) != 0) { + log_warning("Invalid carbon received, from: %s", stanza_from); + return TRUE; + } + const gchar *to = xmpp_stanza_get_to(message); const gchar *from = xmpp_stanza_get_from(message); @@ -722,7 +730,6 @@ _handle_carbons(xmpp_stanza_t *const stanza) Jid *jid_from = jid_create(from); Jid *jid_to = jid_create(to); - Jid *my_jid = jid_create(connection_get_fulljid()); // check for pgp encrypted message char *enc_message = NULL; diff --git a/tests/functionaltests/test_carbons.c b/tests/functionaltests/test_carbons.c index 414284ff..7926a76f 100644 --- a/tests/functionaltests/test_carbons.c +++ b/tests/functionaltests/test_carbons.c @@ -70,7 +70,7 @@ receive_carbon(void **state) assert_true(prof_output_exact("unencrypted")); stbbr_send( - "" + "" "" "" ""