[Asterisk-cvs] asterisk/channels chan_sip.c,1.510.2.18,1.510.2.19

russell at lists.digium.com russell at lists.digium.com
Wed Nov 17 23:26:47 CST 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv26752/channels

Modified Files:
      Tag: v1-0
	chan_sip.c 
Log Message:
fix continuation line parsing (bug #2892)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.510.2.18
retrieving revision 1.510.2.19
diff -u -d -r1.510.2.18 -r1.510.2.19
--- chan_sip.c	15 Nov 2004 02:26:08 -0000	1.510.2.18
+++ chan_sip.c	18 Nov 2004 04:27:12 -0000	1.510.2.19
@@ -2556,33 +2556,32 @@
 		} 
 		/* Check for end-of-line */ 
 		if (msgbuf[h] == '\n') { 
-		/* Check for end-of-message */ 
+			/* Check for end-of-message */ 
 			if (h + 1 == len) 
-			break; 
-		/* Check for a continuation line */ 
-		if (msgbuf[h + 1] == ' ') { 
-		/* Merge continuation line */ 
-			h++; 
+				break; 
+			/* Check for a continuation line */ 
+			if (msgbuf[h + 1] == ' ' || msgbuf[h + 1] == '\t') { 
+				/* Merge continuation line */ 
+				h++; 
+				continue; 
+			} 
+			/* Propagate LF and start new line */ 
+			msgbuf[t++] = msgbuf[h++]; 
+			lws = 0;
 			continue; 
 		} 
-		/* Propagate LF and start new line */ 
-		msgbuf[t++] = msgbuf[h++]; 
-		lws = 0;
-		continue; 
-	} 
-
-	if (msgbuf[h] == ' ' || msgbuf[h] == '\t') { 
-		if (lws) { 
-			h++; 
+		if (msgbuf[h] == ' ' || msgbuf[h] == '\t') { 
+			if (lws) { 
+				h++; 
+				continue; 
+			} 
+			msgbuf[t++] = msgbuf[h++]; 
+			lws = 1; 
 			continue; 
 		} 
 		msgbuf[t++] = msgbuf[h++]; 
-		lws = 1; 
-		continue; 
-	} 
-	msgbuf[t++] = msgbuf[h++]; 
-	if (lws) 
-		lws = 0; 
+		if (lws) 
+			lws = 0; 
 	} 
 	msgbuf[t] = '\0'; 
 	return t; 
@@ -7656,8 +7655,7 @@
 	debug = sip_debug_test_addr(&sin);
 	if (debug)
 		ast_verbose("\n\nSip read: \n%s\n", req.data);
-	if (pedanticsipchecking)
-		req.len = lws2sws(req.data, req.len);
+	req.len = lws2sws(req.data, req.len);
 	parse(&req);
 	if (debug)
 		ast_verbose("%d headers, %d lines\n", req.headers, req.lines);




More information about the svn-commits mailing list