[sr-dev] git:3.3: pua_reginfo: fix setting lengths of contact attributes

Daniel-Constantin Mierla miconda at gmail.com
Mon Feb 25 14:05:58 CET 2013


Module: sip-router
Branch: 3.3
Commit: 5e26e688af8967fdcb4daf218432e8d569eeade6
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5e26e688af8967fdcb4daf218432e8d569eeade6

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Feb 25 13:15:22 2013 +0100

pua_reginfo: fix setting lengths of contact attributes

- fix also for warning from FS#255 reported by Ovidiu Sas
- backport from f76bd09d4800ea63552c11002d7f6f72569e78ed

---

 modules_k/pua_reginfo/notify.c |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/modules_k/pua_reginfo/notify.c b/modules_k/pua_reginfo/notify.c
index 3b20e4e..7116527 100644
--- a/modules_k/pua_reginfo/notify.c
+++ b/modules_k/pua_reginfo/notify.c
@@ -296,22 +296,27 @@ int process_body(str notify_body, udomain_t * domain) {
 				callid.len = strlen(callid.s);
 				received.s = xmlGetAttrContentByName(contacts, "received");
 				if (received.s == NULL) {
-                                        LM_DBG("No received for this contact!\n");
-                                }
-				received.len - strlen(received.s);
+                    LM_DBG("No received for this contact!\n");
+					received.len = 0;
+                } else {
+					received.len = strlen(received.s);
+				}
 
 				path.s = xmlGetAttrContentByName(contacts, "path");	
-				if (received.s == NULL) {
-                                        LM_DBG("No path for this contact!\n");
-                                }
-				path.len = strlen(path.s);
+				if (path.s == NULL) {
+                    LM_DBG("No path for this contact!\n");
+					path.len = 0;
+                } else {
+					path.len = strlen(path.s);
+				}
 
 				user_agent.s = xmlGetAttrContentByName(contacts, "user_agent");
-				if (received.s == NULL) {
-                                        LM_DBG("No user_agent for this contact!\n");
-                                }
-				user_agent.len = strlen(user_agent.s);
-
+				if (user_agent.s == NULL) {
+                    LM_DBG("No user_agent for this contact!\n");
+					user_agent.len = 0;
+                } else {
+					user_agent.len = strlen(user_agent.s);
+				}
 				event = reginfo_parse_event(xmlGetAttrContentByName(contacts, "event"));
 				if (event == EVENT_UNKNOWN) {
 					LM_ERR("No event for this contact!\n");		




More information about the sr-dev mailing list