[sr-dev] git:carstenbock/ims: More bug-fixes:

Carsten Bock carsten at bock.info
Mon Apr 18 10:02:02 CEST 2011


Module: sip-router
Branch: carstenbock/ims
Commit: 7d74d4d9f57e35ee98d6d56b2b393098c0edb581
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7d74d4d9f57e35ee98d6d56b2b393098c0edb581

Author: Carsten Bock <carsten at bock.info>
Committer: Carsten Bock <carsten at bock.info>
Date:   Mon Apr 18 10:00:31 2011 +0200

More bug-fixes:
- Fix proper lookup of dialog, so a dialog does not get inserted many times
- Fix return code of reginfo_handle_notify
- Make sure, the string buffers are set to "0" before using them

---

 modules_k/pua_reginfo/notify.c    |    2 +-
 modules_k/pua_reginfo/usrloc_cb.c |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/modules_k/pua_reginfo/notify.c b/modules_k/pua_reginfo/notify.c
index 0f5416d..b006633 100644
--- a/modules_k/pua_reginfo/notify.c
+++ b/modules_k/pua_reginfo/notify.c
@@ -104,7 +104,7 @@ int process_contact(udomain_t * domain, urecord_t ** ul_record, str aor, str cal
 
 	/* Now we start looking for the contact: */
 	if (((*ul_record)->contacts == 0)
-		|| (ul.get_ucontact(*ul_record, &aor, &callid, &no_str, cseq, &ul_contact) != 0)) {
+		|| (ul.get_ucontact(*ul_record, &aor, &callid, &no_str, cseq+1, &ul_contact) != 0)) {
 		if (ul.insert_ucontact(*ul_record, &aor, &ci, &ul_contact) < 0) {
 			LM_ERR("failed to insert new contact\n");
 			return RESULT_ERROR;
diff --git a/modules_k/pua_reginfo/usrloc_cb.c b/modules_k/pua_reginfo/usrloc_cb.c
index 40dfe1e..addeea9 100644
--- a/modules_k/pua_reginfo/usrloc_cb.c
+++ b/modules_k/pua_reginfo/usrloc_cb.c
@@ -127,26 +127,32 @@ str* build_reginfo_full(urecord_t * record, str uri, ucontact_t* c, int type) {
 				else if (type & UL_CONTACT_EXPIRE) xmlNewProp(contact_node, BAD_CAST "event", BAD_CAST "expired");
 				else if (type & UL_CONTACT_DELETE) xmlNewProp(contact_node, BAD_CAST "event", BAD_CAST "unregistered");
 				else xmlNewProp(contact_node, BAD_CAST "event", BAD_CAST "unknown");
+				memset(buf, 0, sizeof(buf));
 				buf_len = snprintf(buf, sizeof(buf), "%i", (int)(ptr->expires-time(0)));
 				xmlNewProp(contact_node, BAD_CAST "expires", BAD_CAST buf);
 			} else {
 				xmlNewProp(contact_node, BAD_CAST "state", BAD_CAST "active");
 				xmlNewProp(contact_node, BAD_CAST "event", BAD_CAST "registered");
+				memset(buf, 0, sizeof(buf));
 				buf_len = snprintf(buf, sizeof(buf), "%i", (int)(ptr->expires-time(0)));
 				xmlNewProp(contact_node, BAD_CAST "expires", BAD_CAST buf);
 			}
 			if (ptr->q != Q_UNSPECIFIED) {
 				float q = (float)ptr->q/1000;
+				memset(buf, 0, sizeof(buf));
 				buf_len = snprintf(buf, sizeof(buf), "%.3f", q);
 				xmlNewProp(contact_node, BAD_CAST "q", BAD_CAST buf);
 			}
 			/* CallID Attribute */
+			memset(buf, 0, sizeof(buf));
 			buf_len = snprintf(buf, sizeof(buf), "%.*s", ptr->callid.len, ptr->callid.s);
 			xmlNewProp(contact_node, BAD_CAST "callid", BAD_CAST ptr->callid.s);
 			/* CSeq Attribute */
+			memset(buf, 0, sizeof(buf));
 			buf_len = snprintf(buf, sizeof(buf), "%d", ptr->cseq);
 			xmlNewProp(contact_node, BAD_CAST "cseq", BAD_CAST buf);
 			/* URI-Node */
+			memset(buf, 0, sizeof(buf));
 			buf_len = snprintf(buf, sizeof(buf), "%.*s", ptr->c.len, ptr->c.s);
 			uri_node = xmlNewChild(contact_node, NULL, BAD_CAST "uri", BAD_CAST buf) ;
 			if(uri_node == NULL) {




More information about the sr-dev mailing list