diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-04-11 20:07:39 +0000 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-04-11 20:07:39 +0000 |
commit | 3ccf5b0b3434b144dfdc7f74632becfe80ede3b3 (patch) | |
tree | 7fe664e8336e50118bcaadbff027a18b7b91d3b4 | |
parent | aff8b7214bae150c5aac8544396cd938ebc21e47 (diff) | |
download | libmicrohttpd-3ccf5b0b3434b144dfdc7f74632becfe80ede3b3.tar.gz libmicrohttpd-3ccf5b0b3434b144dfdc7f74632becfe80ede3b3.zip |
parse_connection_headers(): fixed uploading by POST files larger then LONG_MAX
-rw-r--r-- | src/microhttpd/connection.c | 8 |
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) | |||
2100 | MHD_HTTP_HEADER_CONTENT_LENGTH); | 2100 | MHD_HTTP_HEADER_CONTENT_LENGTH); |
2101 | if (NULL != clen) | 2101 | if (NULL != clen) |
2102 | { | 2102 | { |
2103 | cval = strtoul (clen, &end, 10); | 2103 | if (!MHD_str_to_uint64_ (clen, &connection->remaining_upload_size, |
2104 | if ( ('\0' != *end) || | 2104 | &end) || |
2105 | ( (LONG_MAX == cval) && (errno == ERANGE) ) ) | 2105 | ('\0' != *end) ) |
2106 | { | 2106 | { |
2107 | connection->remaining_upload_size = 0; | ||
2107 | #ifdef HAVE_MESSAGES | 2108 | #ifdef HAVE_MESSAGES |
2108 | MHD_DLOG (connection->daemon, | 2109 | MHD_DLOG (connection->daemon, |
2109 | "Failed to parse `%s' header `%s', closing connection.\n", | 2110 | "Failed to parse `%s' header `%s', closing connection.\n", |
@@ -2113,7 +2114,6 @@ parse_connection_headers (struct MHD_Connection *connection) | |||
2113 | CONNECTION_CLOSE_ERROR (connection, NULL); | 2114 | CONNECTION_CLOSE_ERROR (connection, NULL); |
2114 | return; | 2115 | return; |
2115 | } | 2116 | } |
2116 | connection->remaining_upload_size = cval; | ||
2117 | } | 2117 | } |
2118 | } | 2118 | } |
2119 | } | 2119 | } |