[Asterisk-cvs] asterisk/channels chan_sip.c,1.773,1.774

kpfleming at lists.digium.com kpfleming at lists.digium.com
Tue Jul 5 21:36:30 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory localhost.localdomain:/tmp/cvs-serv3081/channels

Modified Files:
	chan_sip.c 
Log Message:
don't segfault when peer doesn't send Referred-By (bug #4588)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.773
retrieving revision 1.774
diff -u -d -r1.773 -r1.774
--- chan_sip.c	5 Jul 2005 17:16:16 -0000	1.773
+++ chan_sip.c	6 Jul 2005 01:45:23 -0000	1.774
@@ -5909,9 +5909,11 @@
 		referred_by = NULL;
 	}
 
-	refer_to += 4;
-	referred_by += 4;
-	
+	if (refer_to)
+		refer_to += 4;
+
+	if (referred_by)
+		referred_by += 4;
 	
 	if ((ptr = strchr(refer_to, '?'))) {
 		/* Search for arguments */
@@ -5982,7 +5984,8 @@
 			ast_log(LOG_DEBUG,"Transferred by  (Referred-by: ) %s \n", referred_by);
 		ast_log(LOG_DEBUG,"Transfer Contact Info %s (REFER_CONTACT)\n", h_contact);
 		ast_copy_string(sip_pvt->refer_to, refer_to, sizeof(sip_pvt->refer_to));
-		ast_copy_string(sip_pvt->referred_by, referred_by, sizeof(sip_pvt->referred_by));
+		if (referred_by)
+			ast_copy_string(sip_pvt->referred_by, referred_by, sizeof(sip_pvt->referred_by));
 		if (h_contact) {
 			ast_copy_string(sip_pvt->refer_contact, h_contact, sizeof(sip_pvt->refer_contact));
 		}




More information about the svn-commits mailing list