]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
fix continuation line parsing (bug #2892)
authorRussell Bryant <russell@russellbryant.com>
Thu, 18 Nov 2004 04:27:12 +0000 (04:27 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 18 Nov 2004 04:27:12 +0000 (04:27 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@4291 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index b1a0a5a647741f7fe1f01dc82a47965b56d190d3..a776a688fb111468ba93bc751481d5c70f87c034 100755 (executable)
@@ -2556,33 +2556,32 @@ static int lws2sws(char *msgbuf, int len)
                } 
                /* 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 @@ static int sipsock_read(int *id, int fd, short events, void *ignore)
        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);