Klaus Demo nginx / aa955a2
Request body: error checking fixes, negative rb->rest handling. Negative rb->rest can't happen with current code, but it's good to have it handled anyway. Found by Coverity (CID 744846, 744847, 744848). Maxim Dounin 9 years ago
1 changed file(s) with 11 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
133133 return NGX_OK;
134134 }
135135
136 if (rb->rest < 0) {
137 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
138 "negative request body rest");
139 rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
140 goto done;
141 }
142
136143 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
137144
138145 size = clcf->client_body_buffer_size;
642649 }
643650
644651 rb->chunked = ngx_pcalloc(r->pool, sizeof(ngx_http_chunked_t));
645 if (rb == NULL) {
652 if (rb->chunked == NULL) {
646653 return NGX_HTTP_INTERNAL_SERVER_ERROR;
647654 }
648655
10211028
10221029 /* TODO: coalesce neighbouring buffers */
10231030
1024 ngx_chain_add_copy(r->pool, &rb->bufs, in);
1031 if (ngx_chain_add_copy(r->pool, &rb->bufs, in) != NGX_OK) {
1032 return NGX_HTTP_INTERNAL_SERVER_ERROR;
1033 }
10251034
10261035 return NGX_OK;
10271036 }