[sr-dev] git:master:c0196f10: presence_xml: ensure that node name lenght is at least 9

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 13 17:20:49 CEST 2017


Module: kamailio
Branch: master
Commit: c0196f10790aacb4053db5c3452645ec32e7894a
URL: https://github.com/kamailio/kamailio/commit/c0196f10790aacb4053db5c3452645ec32e7894a

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-13T17:19:33+02:00

presence_xml: ensure that node name lenght is at least 9

- needs to accomodate 'provide-xyz' inside get_final_notify_body()

---

Modified: src/modules/presence_xml/notify_body.c

---

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

---

diff --git a/src/modules/presence_xml/notify_body.c b/src/modules/presence_xml/notify_body.c
index 20160c550c..82b4a4d96e 100644
--- a/src/modules/presence_xml/notify_body.c
+++ b/src/modules/presence_xml/notify_body.c
@@ -224,6 +224,7 @@ str* get_final_notify_body( subs_t *subs, str* notify_body, xmlNodePtr rule_node
 	xmlDocPtr doc= NULL;
 #define KSR_FNB_NAME_SIZE	24
 	char name[KSR_FNB_NAME_SIZE];
+	int name_len;
 	char service_uri_scheme[16];
 	int i= 0, found = 0;
 	str* new_body = NULL;
@@ -268,10 +269,15 @@ str* get_final_notify_body( subs_t *subs, str* notify_body, xmlNodePtr rule_node
 		if(xmlStrcasecmp(node->name, (unsigned char*)"text")== 0)
 			continue;
 
-		LM_DBG("transf_node->name:%s\n",node->name);
+		/* handle 'provide-xyz' nodes */
+		name_len = strlen((char*)(node->name));
+		if(name_len<9) {
+			continue;
+		}
+		LM_DBG("transf_node->name:%s\n", node->name);
 
 		/* skip 'provide-' (e.g., provide-services) */
-		if(strlen((char*)(node->name + 8))>KSR_FNB_NAME_SIZE-1) {
+		if(name_len-8>KSR_FNB_NAME_SIZE-1) {
 			LM_INFO("unsupported handling of: %s\n", (char*)node->name);
 			continue;
 		}




More information about the sr-dev mailing list