No subject


Fri Feb 17 02:32:51 UTC 2012


modesty here, sorry), the relevant bits of code seem to lie with lines
545 to 547 in both 2.3.1 and STABLE-20010403 (or 557 to 559 in
CURRENT-20010403).  Is the following patch, relative to STABLE, safe
enough?

It might be too bold to assume that a continuation header line doesn't
have a bad syntax, like the following:

----------------------------------------
References: <103y89agehr0 at example.com>
	
X-somethingorother: foobar
----------------------------------------

--- inn-STABLE-20010403/nnrpd/article.c	Tue Apr  3 09:03:07 2001
+++ inn-STABLE-20010403.new/nnrpd/article.c	Wed Apr  4 03:14:48 2001
@@ -520,7 +520,7 @@
 char *GetHeader(char *header, BOOL IsLines)
 {
     static char		buff[40];
-    char		*p, *q, *r, *s, *virtualpath;
+    char		*p, *q, *r, *s, *t, *virtualpath;
     /* Bogus value here to make sure that it isn't initialized to \n */
     char		lastchar = ' ';
     char		*limit;
@@ -543,8 +543,25 @@
 		for (; (p < limit) && !isspace((int)*p) ; p++);
 		for (; (p < limit) && isspace((int)*p) ; p++);
 		for (q = p; q < limit; q++) 
-		    if ((*q == '\r') || (*q == '\n'))
-			break;
+		    if ((*q == '\r') || (*q == '\n')) {
+			/* Check for continuation header lines */
+			t = q + 1;
+			if (t < limit) {
+			    if ((*q == '\r' && *t == '\n')) {
+				t++;
+				if (t == limit)
+				    break;
+			    }
+			    if ((*t == '\t' || *t == ' ')) {
+				for (; (t < limit) && isspace((int)*t) ; t++);
+				q = t;
+			    } else {
+				break;
+			    }
+			} else {
+			    break;
+			}
+		    }
 		if (q == limit)
 		    return NULL;
 		if (caseEQn("Path", header, headerlen))


-- 
In the beginning was the Bit, and the Bit was Zero.  Then Someone
said, Let there be One, and there was One.  And Someone blessed them,
and Someone said unto them, Be fruitful, and multiply, and replenish
the Word and subdue it: and have dominion over every thing that is.


More information about the inn-workers mailing list