comparison src/http/v2/ngx_http_v2_filter_module.c @ 6377:11e019750adc

HTTP/2: fixed possible buffer overrun (ticket #893). Due to greater priority of the unary plus operator over the ternary operator the expression didn't work as expected. That might result in one byte less allocation than needed for the HEADERS frame buffer.
author Valentin Bartenev <vbart@nginx.com>
date Thu, 04 Feb 2016 18:01:04 +0300
parents ec6b07be88a5
children ba3c2ca21aa5
comparison
equal deleted inserted replaced
6376:0e0e2e522fa2 6377:11e019750adc
213 len = status ? 1 : 1 + ngx_http_v2_literal_size("418"); 213 len = status ? 1 : 1 + ngx_http_v2_literal_size("418");
214 214
215 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 215 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
216 216
217 if (r->headers_out.server == NULL) { 217 if (r->headers_out.server == NULL) {
218 len += 1 + clcf->server_tokens ? ngx_http_v2_literal_size(NGINX_VER) 218 len += 1 + (clcf->server_tokens ? ngx_http_v2_literal_size(NGINX_VER)
219 : ngx_http_v2_literal_size("nginx"); 219 : ngx_http_v2_literal_size("nginx"));
220 } 220 }
221 221
222 if (r->headers_out.date == NULL) { 222 if (r->headers_out.date == NULL) {
223 len += 1 + ngx_http_v2_literal_size("Wed, 31 Dec 1986 18:00:00 GMT"); 223 len += 1 + ngx_http_v2_literal_size("Wed, 31 Dec 1986 18:00:00 GMT");
224 } 224 }