From 71f4194513b679ab2f04644700a872ea2c8cb0dd Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Wed, 31 Jul 2013 01:37:02 +0300 Subject: [PATCH 1/2] fixed null pointer dereference in /join command Command /join @/ leads to crash because jid_create("@/") returns NULL --- src/command/command.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/command/command.c b/src/command/command.c index 2e31605d..d8b955a2 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -2673,10 +2673,15 @@ _cmd_join(gchar **args, struct cmd_help_t help) return TRUE; } + Jid *room_arg = jid_create(args[0]); + if (room_arg == NULL) { + cons_show_error("Specified room has incorrect format"); + return TRUE; + } + int num_args = g_strv_length(args); char *room = NULL; char *nick = NULL; - Jid *room_arg = jid_create(args[0]); GString *room_str = g_string_new(""); Jid *my_jid = jid_create(jabber_get_fulljid()); From e170965c93ae838f3eff00f7558de5186268dd8b Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 4 Aug 2013 17:04:15 +0100 Subject: [PATCH 2/2] Added patch from Dmitry to fix crash on delayed message from contact not in roster fixes #219 --- src/ui/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ui/core.c b/src/ui/core.c index 126fe127..83839952 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -399,10 +399,12 @@ ui_incoming_msg(const char * const from, const char * const message, if (tv_stamp == NULL) { win_print_time(window, '-'); } else { - // if show users status first, when receiving message via delayed delivery + // show users status first, when receiving message via delayed delivery if (win_created) { PContact pcontact = roster_get_contact(from); - win_show_contact(window, pcontact); + if (pcontact != NULL) { + win_show_contact(window, pcontact); + } } GDateTime *time = g_date_time_new_from_timeval_utc(tv_stamp); gchar *date_fmt = g_date_time_format(time, "%H:%M:%S");