[asterisk-commits] kmoore: trunk r369995 - in /trunk: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 12 14:05:16 CDT 2012


Author: kmoore
Date: Thu Jul 12 14:05:11 2012
New Revision: 369995

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369995
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
........

Merged revisions 369993 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 369994 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=369995&r1=369994&r2=369995
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Jul 12 14:05:11 2012
@@ -12855,11 +12855,11 @@
 	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), ast_uri_sip_user);
-		l = tmp_l;
 	}
 
 	ourport = (p->fromdomainport) ? p->fromdomainport : ast_sockaddr_port(&p->ourip);
@@ -12873,10 +12873,10 @@
 
 	if (!sip_standard_port(p->socket.type, ourport)) {
 		size_t offset = strlen(from);
-		snprintf(&from[offset], sizeof(from) - offset, "<sip:%s@%s:%d>;tag=%s", l, d, ourport, p->tag);
+		snprintf(&from[offset], sizeof(from) - offset, "<sip:%s@%s:%d>;tag=%s", tmp_l, d, ourport, p->tag);
 	} else {
 		size_t offset = strlen(from);
-		snprintf(&from[offset], sizeof(from) - offset, "<sip:%s@%s>;tag=%s", l, d, p->tag);
+		snprintf(&from[offset], sizeof(from) - offset, "<sip:%s@%s>;tag=%s", tmp_l, d, p->tag);
 	}
 
 	if (!ast_strlen_zero(explicit_uri)) {




More information about the asterisk-commits mailing list