libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 3ccf5b0b3434b144dfdc7f74632becfe80ede3b3
parent aff8b7214bae150c5aac8544396cd938ebc21e47
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Mon, 11 Apr 2016 20:07:39 +0000

parse_connection_headers(): fixed uploading by POST files larger then LONG_MAX

Diffstat:
Msrc/microhttpd/connection.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -2100,10 +2100,11 @@ parse_connection_headers (struct MHD_Connection *connection) MHD_HTTP_HEADER_CONTENT_LENGTH); if (NULL != clen) { - cval = strtoul (clen, &end, 10); - if ( ('\0' != *end) || - ( (LONG_MAX == cval) && (errno == ERANGE) ) ) + if (!MHD_str_to_uint64_ (clen, &connection->remaining_upload_size, + &end) || + ('\0' != *end) ) { + connection->remaining_upload_size = 0; #ifdef HAVE_MESSAGES MHD_DLOG (connection->daemon, "Failed to parse `%s' header `%s', closing connection.\n", @@ -2113,7 +2114,6 @@ parse_connection_headers (struct MHD_Connection *connection) CONNECTION_CLOSE_ERROR (connection, NULL); return; } - connection->remaining_upload_size = cval; } } }