[asterisk-commits] tilghman: trunk r166696 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 23 14:47:09 CST 2008


Author: tilghman
Date: Tue Dec 23 14:47:08 2008
New Revision: 166696

URL: http://svn.digium.com/view/asterisk?view=rev&rev=166696
Log:
Allow semicolons and extended characters in user-specified SIP headers.
(closes issue #14110)
 Reported by: gork
 Patches: 
       20081222__bug14110__2.diff.txt uploaded by Corydon76 (license 14)
 Tested by: gork, putnopvut

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=166696&r1=166695&r2=166696
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Dec 23 14:47:08 2008
@@ -23616,7 +23616,7 @@
 	int no = 0;
 	int ok = FALSE;
 	char varbuf[30];
-	char *inbuf = data;
+	char *inbuf = data, *subbuf;
 	
 	if (ast_strlen_zero(inbuf)) {
 		ast_log(LOG_WARNING, "This application requires the argument: Header\n");
@@ -23630,13 +23630,18 @@
 		snprintf(varbuf, sizeof(varbuf), "__SIPADDHEADER%.2d", no);
 
 		/* Compare without the leading underscores */
-		if( (pbx_builtin_getvar_helper(chan, (const char *) varbuf + 2) == (const char *) NULL) )
+		if ((pbx_builtin_getvar_helper(chan, (const char *) varbuf + 2) == (const char *) NULL)) {
 			ok = TRUE;
+		}
 	}
 	if (ok) {
-		pbx_builtin_setvar_helper (chan, varbuf, inbuf);
-		if (sipdebug)
+		size_t len = strlen(inbuf);
+		subbuf = alloca(len + 1);
+		ast_get_encoded_str(inbuf, subbuf, len + 1);
+		pbx_builtin_setvar_helper(chan, varbuf, subbuf);
+		if (sipdebug) {
 			ast_debug(1, "SIP Header added \"%s\" as %s\n", inbuf, varbuf);
+		}
 	} else {
 		ast_log(LOG_WARNING, "Too many SIP headers added, max 50\n");
 	}




More information about the asterisk-commits mailing list