[sr-dev] git:4.4:e43d82db: presence: fix crash when no dialog.id on dialog-info xml

Victor Seva linuxmaniac at torreviejawireless.org
Fri Sep 23 13:37:06 CEST 2016


Module: kamailio
Branch: 4.4
Commit: e43d82db89e57a47418d4ccdd283d8b2de82e7e6
URL: https://github.com/kamailio/kamailio/commit/e43d82db89e57a47418d4ccdd283d8b2de82e7e6

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2016-09-23T13:35:35+02:00

presence: fix crash when no dialog.id on dialog-info xml

Fix #794

(cherry picked from commit 53b139567cd2c828cf2cf387029396ef55351289)

---

Modified: modules/presence/presentity.c

---

Diff:  https://github.com/kamailio/kamailio/commit/e43d82db89e57a47418d4ccdd283d8b2de82e7e6.diff
Patch: https://github.com/kamailio/kamailio/commit/e43d82db89e57a47418d4ccdd283d8b2de82e7e6.patch

---

diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c
index e601153..00fdbfd 100644
--- a/modules/presence/presentity.c
+++ b/modules/presence/presentity.c
@@ -691,13 +691,13 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body,
 			}
 
 			check_if_dialog(*body, &is_dialog, &dialog_id);
+			if (is_dialog == 1) {
+				if (delete_presentity_if_dialog_id_exists(presentity, dialog_id) < 0) {
+					goto error;
+				}
 
-			if (delete_presentity_if_dialog_id_exists(presentity, dialog_id) < 0) {
-				goto error;
+				free(dialog_id);
 			}
-
-			free(dialog_id);
-
 			LM_DBG("inserting %d cols into table\n",n_query_cols);
 
 			if (pa_dbf.insert(pa_db, query_cols, query_vals, n_query_cols) < 0)




More information about the sr-dev mailing list