diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-10-17 17:31:37 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-10-17 17:31:37 +0300 |
commit | 381f2705a6236209c096c71d2cef507bd50fb7e3 (patch) | |
tree | fae8dd340f3e08c6668bfe30567cf703b4c2fba0 | |
parent | 44b342f7ca7469f30df44c07936170e7635da149 (diff) | |
download | libmicrohttpd-381f2705a6236209c096c71d2cef507bd50fb7e3.tar.gz libmicrohttpd-381f2705a6236209c096c71d2cef507bd50fb7e3.zip |
Fixed parsing of "\r\r", "\r", "\n\r" and "\n\n" as a single linefeed for chunked upload
-rw-r--r-- | src/microhttpd/connection.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 53e3b9ec..d524954a 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -3096,12 +3096,11 @@ process_request_body (struct MHD_Connection *connection) | |||
3096 | size_t i; | 3096 | size_t i; |
3097 | /* skip new line at the *end* of a chunk */ | 3097 | /* skip new line at the *end* of a chunk */ |
3098 | i = 0; | 3098 | i = 0; |
3099 | if ( ('\r' == buffer_head[i]) || | 3099 | if ( ('\r' == buffer_head[i]) && |
3100 | ('\n' == buffer_head[i]) ) | 3100 | ('\n' == buffer_head[i + 1]) ) |
3101 | i++; /* skip 1st part of line feed */ | 3101 | i += 2; /* skip CRLF */ |
3102 | if ( ('\r' == buffer_head[i]) || | 3102 | else if ('\n' == buffer_head[i]) /* TODO: Add MHD option to disallow */ |
3103 | ('\n' == buffer_head[i]) ) | 3103 | i++; /* skip bare LF */ |
3104 | i++; /* skip 2nd part of line feed */ | ||
3105 | if (0 == i) | 3104 | if (0 == i) |
3106 | { | 3105 | { |
3107 | /* malformed encoding */ | 3106 | /* malformed encoding */ |