[Asterisk-cvs] asterisk/channels chan_sip.c,1.292.2.1,1.292.2.2

markster at lists.digium.com markster at lists.digium.com
Sun Feb 8 23:31:17 CST 2004


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

Modified Files:
      Tag: v1-0_stable
	chan_sip.c 
Log Message:
Properly fully url decode REPLACES and check edge condition


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.292.2.1
retrieving revision 1.292.2.2
diff -u -d -r1.292.2.1 -r1.292.2.2
--- chan_sip.c	7 Feb 2004 07:14:13 -0000	1.292.2.1
+++ chan_sip.c	9 Feb 2004 05:40:00 -0000	1.292.2.2
@@ -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