summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-04-11 20:07:39 +0000
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-04-11 20:07:39 +0000
commit3ccf5b0b3434b144dfdc7f74632becfe80ede3b3 (patch)
tree7fe664e8336e50118bcaadbff027a18b7b91d3b4
parentaff8b7214bae150c5aac8544396cd938ebc21e47 (diff)
parse_connection_headers(): fixed uploading by POST files larger then LONG_MAX
-rw-r--r--src/microhttpd/connection.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index c65315d3..10ac43bf 100644
--- 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;
}
}
}