about summary refs log tree commit diff
path: root/blaze822.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-13 20:32:44 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-13 20:32:44 +0200
commitd0d371114c6cce9885d02bc185c65e83e95b94cb (patch)
treeafc5136859427b1235402a7b88861051d3a193bd /blaze822.c
parentd687378b628d037ef9e7ac6c57bd28462bafdea5 (diff)
downloadmblaze-d0d371114c6cce9885d02bc185c65e83e95b94cb.tar.gz
mblaze-d0d371114c6cce9885d02bc185c65e83e95b94cb.tar.xz
mblaze-d0d371114c6cce9885d02bc185c65e83e95b94cb.zip
blaze822: compression fixes
Diffstat (limited to 'blaze822.c')
-rw-r--r--blaze822.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/blaze822.c b/blaze822.c
index db56d03..6d1b643 100644
--- a/blaze822.c
+++ b/blaze822.c
@@ -260,12 +260,13 @@ unfold_hdr(char *buf, char *end)
 		}
 	}
 
+	// compress fields by removing fws
 	for (s = buf; s < end; ) {
 		char *t, *h;
 		size_t l = strlen(s) + 1;
 
 		if ((t = h = strchr(s, '\n'))) {
-			while (*h) {
+			while (h < end && *h) {
 				if (*h == '\n') {
 					*t++ = ' ';
 					while (*h && isfws(*h))
@@ -273,7 +274,8 @@ unfold_hdr(char *buf, char *end)
 				}
 				*t++ = *h++;
 			}
-			*t = 0;
+			while (t < h)
+				*t++ = 0;
 		}
 		s += l;
 	}