diff options
Diffstat (limited to 'src/daemon/connection.c')
-rw-r--r-- | src/daemon/connection.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/daemon/connection.c b/src/daemon/connection.c index 1bc8001c..33571ea9 100644 --- a/src/daemon/connection.c +++ b/src/daemon/connection.c | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "internal.h" | 28 | #include "internal.h" |
29 | #include <limits.h> | ||
29 | #include "connection.h" | 30 | #include "connection.h" |
30 | #include "memorypool.h" | 31 | #include "memorypool.h" |
31 | #include "response.h" | 32 | #include "response.h" |
@@ -1252,6 +1253,7 @@ process_request_body (struct MHD_Connection *connection) | |||
1252 | int instant_retry; | 1253 | int instant_retry; |
1253 | int malformed; | 1254 | int malformed; |
1254 | char *buffer_head; | 1255 | char *buffer_head; |
1256 | char *end; | ||
1255 | 1257 | ||
1256 | if (connection->response != NULL) | 1258 | if (connection->response != NULL) |
1257 | return; /* already queued a response */ | 1259 | return; /* already queued a response */ |
@@ -1326,11 +1328,8 @@ process_request_body (struct MHD_Connection *connection) | |||
1326 | if (!malformed) | 1328 | if (!malformed) |
1327 | { | 1329 | { |
1328 | buffer_head[i] = '\0'; | 1330 | buffer_head[i] = '\0'; |
1329 | malformed = | 1331 | connection->current_chunk_size = strtoul (buffer_head, &end, 16); |
1330 | (1 != SSCANF (buffer_head, "%X", | 1332 | malformed = ('\0' != *end); |
1331 | &connection->current_chunk_size)) && | ||
1332 | (1 != SSCANF (buffer_head, "%x", | ||
1333 | &connection->current_chunk_size)); | ||
1334 | } | 1333 | } |
1335 | if (malformed) | 1334 | if (malformed) |
1336 | { | 1335 | { |
@@ -1655,6 +1654,7 @@ parse_connection_headers (struct MHD_Connection *connection) | |||
1655 | unsigned MHD_LONG_LONG cval; | 1654 | unsigned MHD_LONG_LONG cval; |
1656 | struct MHD_Response *response; | 1655 | struct MHD_Response *response; |
1657 | const char *enc; | 1656 | const char *enc; |
1657 | char *end; | ||
1658 | 1658 | ||
1659 | parse_cookie_header (connection); | 1659 | parse_cookie_header (connection); |
1660 | if ((0 != (MHD_USE_PEDANTIC_CHECKS & connection->daemon->options)) | 1660 | if ((0 != (MHD_USE_PEDANTIC_CHECKS & connection->daemon->options)) |
@@ -1687,7 +1687,9 @@ parse_connection_headers (struct MHD_Connection *connection) | |||
1687 | MHD_HTTP_HEADER_CONTENT_LENGTH); | 1687 | MHD_HTTP_HEADER_CONTENT_LENGTH); |
1688 | if (clen != NULL) | 1688 | if (clen != NULL) |
1689 | { | 1689 | { |
1690 | if (1 != SSCANF (clen, "%" MHD_LONG_LONG_PRINTF "u", &cval)) | 1690 | cval = strtoul (clen, &end, 10); |
1691 | if ( ('\0' != *end) || | ||
1692 | ( (LONG_MAX == cval) && (errno == ERANGE) ) ) | ||
1691 | { | 1693 | { |
1692 | #if HAVE_MESSAGES | 1694 | #if HAVE_MESSAGES |
1693 | MHD_DLOG (connection->daemon, | 1695 | MHD_DLOG (connection->daemon, |