[asterisk-commits] oej: branch 1.4 r54787 - /branches/1.4/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Feb 16 05:06:24 MST 2007


Author: oej
Date: Fri Feb 16 06:06:23 2007
New Revision: 54787

URL: http://svn.digium.com/view/asterisk?view=rev&rev=54787
Log:
Issue #7541 - Handle multipart attachments to SIP messages - even if boundary is quoted.

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=54787&r1=54786&r2=54787
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Fri Feb 16 06:06:23 2007
@@ -4620,6 +4620,7 @@
 	const char *search;
 	char *boundary;
 	unsigned int x;
+	int boundaryisquoted = FALSE;
 
 	content_type = get_header(req, "Content-Type");
 
@@ -4639,14 +4640,23 @@
 		return 0;
 
 	search += 10;
-
 	if (ast_strlen_zero(search))
 		return 0;
+
+	/* If the boundary is quoted with ", remove quote */
+	if (*search == '\"')  {
+		search++;
+		boundaryisquoted = TRUE;
+	}
 
 	/* make a duplicate of the string, with two extra characters
 	   at the beginning */
 	boundary = ast_strdupa(search - 2);
 	boundary[0] = boundary[1] = '-';
+
+	/* Remove final quote */
+	if (boundaryisquoted)
+		boundary[strlen(boundary) - 1] = '\0';
 
 	/* search for the boundary marker, but stop when there are not enough
 	   lines left for it, the Content-Type header and at least one line of



More information about the asterisk-commits mailing list