summaryrefslogtreecommitdiff
path: root/src/request.c
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2012-04-19 13:02:06 +0000
committerStefan Bühler <stbuehler@web.de>2012-04-19 13:02:06 +0000
commit01f9debec31c8696d324db3d1b6a092a4e853077 (patch)
treef2c313384d42e13b6304c56ab9e7b17c65280c5b /src/request.c
parente697869e347f43d2cb721a2364090801878ffea2 (diff)
downloadlighttpd-git-01f9debec31c8696d324db3d1b6a092a4e853077.tar.gz
Fix handling of empty header list entries in http_request_split_value, fixing invalid read in valgrind (fixes #2413)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2830 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/request.c')
-rw-r--r--src/request.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/request.c b/src/request.c
index a48bf48d..e76a98fb 100644
--- a/src/request.c
+++ b/src/request.c
@@ -241,9 +241,11 @@ static int http_request_split_value(array *vals, buffer *b) {
start = s;
for (; *s != ',' && i < b->used - 1; i++, s++);
+ if (start == s) break; /* empty fields are skipped */
end = s - 1;
- for (; (*end == ' ' || *end == '\t') && end > start; end--);
+ for (; end > start && (*end == ' ' || *end == '\t'); end--);
+ if (start == end) break; /* empty fields are skipped */
if (NULL == (ds = (data_string *)array_get_unused_element(vals, TYPE_STRING))) {
ds = data_string_init();