comparison src/http/ngx_http_request_body.c @ 5588:6fc3921025f0

Request body: avoid potential overflow.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 03 Mar 2014 17:39:53 +0400
parents 4aa64f695031
children b8926ba4d087
comparison
equal deleted inserted replaced
5587:ceecde39853f 5588:6fc3921025f0
951 951
952 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 952 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
953 953
954 if (clcf->client_max_body_size 954 if (clcf->client_max_body_size
955 && clcf->client_max_body_size 955 && clcf->client_max_body_size
956 < r->headers_in.content_length_n + rb->chunked->size) 956 - r->headers_in.content_length_n < rb->chunked->size)
957 { 957 {
958 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 958 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
959 "client intended to send too large chunked " 959 "client intended to send too large chunked "
960 "body: %O bytes", 960 "body: %O+%O bytes",
961 r->headers_in.content_length_n 961 r->headers_in.content_length_n,
962 + rb->chunked->size); 962 rb->chunked->size);
963 963
964 r->lingering_close = 1; 964 r->lingering_close = 1;
965 965
966 return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE; 966 return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE;
967 } 967 }