comparison src/http/ngx_http_write_filter_module.c @ 4961:ed576bd1d9c0

Limit rate: fixed integer overflow in limit calculation (ticket #256). Patch by Alexey Antropov.
author Valentin Bartenev <vbart@nginx.com>
date Wed, 12 Dec 2012 14:48:48 +0000
parents 3464d0b63300
children 06fbbde04098
comparison
equal deleted inserted replaced
4960:b39d947fcb82 4961:ed576bd1d9c0
205 205
206 return NGX_ERROR; 206 return NGX_ERROR;
207 } 207 }
208 208
209 if (r->limit_rate) { 209 if (r->limit_rate) {
210 limit = r->limit_rate * (ngx_time() - r->start_sec + 1) 210 limit = (off_t) r->limit_rate * (ngx_time() - r->start_sec + 1)
211 - (c->sent - clcf->limit_rate_after); 211 - (c->sent - clcf->limit_rate_after);
212 212
213 if (limit <= 0) { 213 if (limit <= 0) {
214 c->write->delayed = 1; 214 c->write->delayed = 1;
215 ngx_add_timer(c->write, 215 ngx_add_timer(c->write,