[asterisk-commits] kmoore: branch 1.8 r369993 - /branches/1.8/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 12 13:54:31 CDT 2012


Author: kmoore
Date: Thu Jul 12 13:54:29 2012
New Revision: 369993

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369993
Log:
Prevent double uri_escaping in chan_sip when pedantic is enabled

If pedantic mode is enabled, outbound invites will have double-escaped
contacts.  This avoids setting an already-escaped string into a field
where it is expected to be unescaped.

(closes issue ASTERISK-20023)
Reported-by: Walter Doekes

Modified:
    branches/1.8/channels/chan_sip.c

Modified: branches/1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_sip.c?view=diff&rev=369993&r1=369992&r2=369993
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Thu Jul 12 13:54:29 2012
@@ -12044,18 +12044,18 @@
 	else /* Save for any further attempts */
 		ast_string_field_set(p, fromname, n);
 
+	ast_copy_string(tmp_l, l, sizeof(tmp_l));
 	if (sip_cfg.pedanticsipchecking) {
 		ast_escape_quoted(n, tmp_n, sizeof(tmp_n));
 		n = tmp_n;
 		ast_uri_encode(l, tmp_l, sizeof(tmp_l), 0);
-		l = tmp_l;
 	}
 
 	ourport = (p->fromdomainport) ? p->fromdomainport : ast_sockaddr_port(&p->ourip);
 	if (!sip_standard_port(p->socket.type, ourport)) {
-		snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s:%d>;tag=%s", n, l, d, ourport, p->tag);
+		snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s:%d>;tag=%s", n, tmp_l, d, ourport, p->tag);
 	} else {
-		snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s>;tag=%s", n, l, d, p->tag);
+		snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s>;tag=%s", n, tmp_l, d, p->tag);
 	}
 
 	if (!ast_strlen_zero(explicit_uri)) {




More information about the asterisk-commits mailing list