[asterisk-commits] rizzo: branch 1.4 r47823 - /branches/1.4/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Nov 18 10:59:36 MST 2006


Author: rizzo
Date: Sat Nov 18 11:59:35 2006
New Revision: 47823

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47823
Log:
fix bug 7450 - Parsing fails if From header contains angle brackets 
(the bug was only in a corner case where the < was right after the
opening quote, and the fix is trivial).


Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=47823&r1=47822&r2=47823
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Sat Nov 18 11:59:35 2006
@@ -8748,11 +8748,12 @@
 	if (!end || end == input)	/* we require a part in brackets */
 		return NULL;
 
-	/* move away from "<" */
-	end--;
-
-	/* we found "name" */
-	if (tmp && tmp < end) {
+	end--; /* move just before "<" */
+
+	if (tmp && tmp <= end) {
+		/* The quote (tmp) precedes the bracket (end+1).
+		 * Find the matching quote and return the content.
+		 */
 		end = strchr(tmp+1, '"');
 		if (!end)
 			return NULL;
@@ -8762,7 +8763,7 @@
 			bytes = maxbytes;
 		ast_copy_string(output, tmp + 1, bytes);
 	} else {
-		/* we didn't find "name" */
+		/* No quoted string, or it is inside brackets. */
 		/* clear the empty characters in the begining*/
 		input = ast_skip_blanks(input);
 		/* clear the empty characters in the end */



More information about the asterisk-commits mailing list