changeset 17722:8e6d2afb14c5

lib-http: Added asserts to make sure CR or LF can't be added accidentally to HTTP headers.
author Timo Sirainen <tss@iki.fi>
date Fri, 15 Aug 2014 15:59:17 +0300
parents 664afffb22a3
children 74e5657964d3
files src/lib-http/http-server-response.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-http/http-server-response.c	Fri Aug 15 15:22:46 2014 +0300
+++ b/src/lib-http/http-server-response.c	Fri Aug 15 15:59:17 2014 +0300
@@ -68,6 +68,9 @@
 				    const char *key, const char *value)
 {
 	i_assert(!resp->submitted);
+	i_assert(strchr(key, '\r') == NULL && strchr(key, '\n') == NULL);
+	i_assert(strchr(value, '\r') == NULL && strchr(value, '\n') == NULL);
+
 	/* mark presence of special headers */
 	switch (key[0]) {
 	case 'c': case 'C':