[Asterisk-cvs] asterisk/channels chan_sip.c,1.293,1.294

markster at lists.digium.com markster at lists.digium.com
Sun Feb 8 23:29:33 CST 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv6257/channels

Modified Files:
	chan_sip.c 
Log Message:
Properly fully URL decode the REPLACES in SIP and also watch for edge condition (bug #1015)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.293
retrieving revision 1.294
diff -u -d -r1.293 -r1.294
--- chan_sip.c	7 Feb 2004 07:13:33 -0000	1.293
+++ chan_sip.c	9 Feb 2004 05:38:17 -0000	1.294
@@ -3958,11 +3958,15 @@
 		a++;
 		if (!strncasecmp(a, "REPLACES=", strlen("REPLACES="))) {
 			strncpy(tmp5, a + strlen("REPLACES="), sizeof(tmp5) - 1);
-			if ((a = strchr(tmp5, '%'))) {
+			a = tmp5;
+			while ((a = strchr(a, '%'))) {
 				/* Yuck!  Pingtel converts the '@' to a %40, icky icky!  Convert
 				   back to an '@' */
+				if (strlen(a) < 3)
+					break;
 				*a = hex2int(a[1]) * 16 + hex2int(a[2]);
 				memmove(a + 1, a+3, strlen(a + 3) + 1);
+				a++;
 			}
 			if ((a = strchr(tmp5, '%'))) 
 				*a = '\0';




More information about the svn-commits mailing list