[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 07/11: process_request_body(): fixed: do not skip chunk
From: |
gnunet |
Subject: |
[libmicrohttpd] 07/11: process_request_body(): fixed: do not skip chunk closure when too few data available |
Date: |
Wed, 24 Nov 2021 19:08:20 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 8a69a4492345c359ab804109d97efb7e292a2c7b
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Nov 22 21:37:44 2021 +0300
process_request_body(): fixed: do not skip chunk closure when too few data
available
---
src/microhttpd/connection.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 0426620b..e65fc0b0 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -3113,17 +3113,20 @@ process_request_body (struct MHD_Connection *connection)
mhd_assert (MHD_SIZE_UNKNOWN == connection->remaining_upload_size);
if ( (connection->current_chunk_offset ==
connection->current_chunk_size) &&
- (0LLU != connection->current_chunk_offset) &&
- (available >= 2) )
+ (0 != connection->current_chunk_size) )
{
size_t i;
+ mhd_assert (0 != available);
/* skip new line at the *end* of a chunk */
i = 0;
- if ( ('\r' == buffer_head[i]) &&
- ('\n' == buffer_head[i + 1]) )
+ if ( (2 <= available) &&
+ ('\r' == buffer_head[0]) &&
+ ('\n' == buffer_head[1]) )
i += 2; /* skip CRLF */
- else if ('\n' == buffer_head[i]) /* TODO: Add MHD option to disallow */
+ else if ('\n' == buffer_head[0]) /* TODO: Add MHD option to disallow */
i++; /* skip bare LF */
+ else if (2 > available)
+ break; /* need more upload data */
if (0 == i)
{
/* malformed encoding */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (52b79898 -> ad9fc5c6), gnunet, 2021/11/24
- [libmicrohttpd] 03/11: process_request_body(): removed redundant check, gnunet, 2021/11/24
- [libmicrohttpd] 02/11: process_request_body(): replaced 'int' with 'bool', gnunet, 2021/11/24
- [libmicrohttpd] 04/11: process_request_body(): unify checks for chunked upload, gnunet, 2021/11/24
- [libmicrohttpd] 06/11: process_request_body(): removed one more unneeded check, gnunet, 2021/11/24
- [libmicrohttpd] 07/11: process_request_body(): fixed: do not skip chunk closure when too few data available,
gnunet <=
- [libmicrohttpd] 08/11: process_request_body(): do not process when no more data is available, gnunet, 2021/11/24
- [libmicrohttpd] 05/11: process_request_body(): removed unneeded check, gnunet, 2021/11/24
- [libmicrohttpd] 11/11: process_request_body(): added assert, gnunet, 2021/11/24
- [libmicrohttpd] 09/11: process_request_body(): minor improvement of code readability, gnunet, 2021/11/24
- [libmicrohttpd] 10/11: process_request_body(): fixed: removed wrong special handling of the termination chunk, gnunet, 2021/11/24
- [libmicrohttpd] 01/11: test_client_put_stop: use TCP_NODELAY for client, gnunet, 2021/11/24