summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2010-02-25 20:43:49 +0000
committercorvid <corvid@lavabit.com>2010-02-25 20:43:49 +0000
commit0bd335403e7793551bb76cbdf629fbba05fdfecc (patch)
tree6fcb75a688e68e77f9557c369ff914c3a6ef76cb
parent485130cbcc9e60fb7cfab7f2253e30fb8c8dbe37 (diff)
more robust http header field parsing
I noticed that I could trick it with a field like "Content-TypexContent-Type: text/html\n", and I didn't like that.
-rw-r--r--src/cache.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cache.c b/src/cache.c
index 2bd7bb58..0116fbf5 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -595,6 +595,7 @@ static char *Cache_parse_field(const char *header, const char *fieldname)
field = dStrndup(header + i, j);
return field;
}
+ while (header[i] != '\n') i++;
}
return NULL;
}
@@ -630,6 +631,8 @@ static Dlist *Cache_parse_multiple_fields(const char *header,
j--;
field = dStrndup(header + i, j);
dList_append(fields, field);
+ } else {
+ while (header[i] != '\n') i++;
}
}