diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-11-24 16:22:45 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-11-24 21:55:56 +0300 |
commit | e9e6a5f9d6ed3b328a78c749270733e6fd6c7ba6 (patch) | |
tree | f29c227aaef6a3024eb53ab45aa4d7e9a8fbf0b9 /src/microhttpd/connection.c | |
parent | a6e53c3676feb49046466e8eee1bbae786d3d8c7 (diff) | |
download | libmicrohttpd-e9e6a5f9d6ed3b328a78c749270733e6fd6c7ba6.tar.gz libmicrohttpd-e9e6a5f9d6ed3b328a78c749270733e6fd6c7ba6.zip |
parse_connection_headers(): simplified 'Content-Length' processing
Diffstat (limited to 'src/microhttpd/connection.c')
-rw-r--r-- | src/microhttpd/connection.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 816bd5a8..74660bc5 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -3543,7 +3543,7 @@ parse_connection_headers (struct MHD_Connection *connection) | |||
3543 | { | 3543 | { |
3544 | const char *clen; | 3544 | const char *clen; |
3545 | const char *enc; | 3545 | const char *enc; |
3546 | const char *end; | 3546 | size_t val_len; |
3547 | 3547 | ||
3548 | parse_cookie_header (connection); | 3548 | parse_cookie_header (connection); |
3549 | if ( (1 <= connection->daemon->strict_for_client) && | 3549 | if ( (1 <= connection->daemon->strict_for_client) && |
@@ -3589,12 +3589,15 @@ parse_connection_headers (struct MHD_Connection *connection) | |||
3589 | MHD_STATICSTR_LEN_ ( | 3589 | MHD_STATICSTR_LEN_ ( |
3590 | MHD_HTTP_HEADER_CONTENT_LENGTH), | 3590 | MHD_HTTP_HEADER_CONTENT_LENGTH), |
3591 | &clen, | 3591 | &clen, |
3592 | NULL)) | 3592 | &val_len)) |
3593 | { | 3593 | { |
3594 | end = clen + MHD_str_to_uint64_ (clen, | 3594 | size_t num_digits; |
3595 | &connection->remaining_upload_size); | 3595 | |
3596 | if ( (clen == end) || | 3596 | num_digits = MHD_str_to_uint64_n_ (clen, |
3597 | ('\0' != *end) ) | 3597 | val_len, |
3598 | &connection->remaining_upload_size); | ||
3599 | if ( (val_len != num_digits) || | ||
3600 | (0 == num_digits) ) | ||
3598 | { | 3601 | { |
3599 | connection->remaining_upload_size = 0; | 3602 | connection->remaining_upload_size = 0; |
3600 | #ifdef HAVE_MESSAGES | 3603 | #ifdef HAVE_MESSAGES |