]> git.kaiwu.me - nginx.git/commitdiff
Merge of r4962: limit_rate fix.
authorMaxim Dounin <mdounin@mdounin.ru>
Sun, 10 Feb 2013 03:20:00 +0000 (03:20 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Sun, 10 Feb 2013 03:20:00 +0000 (03:20 +0000)
Limit rate: fixed integer overflow in limit calculation (ticket #256).

Patch by Alexey Antropov.

src/http/ngx_http_write_filter_module.c

index fd44bc65948c41a349a1cfbc682180a40c964984..5594c7faaade91464ad9f64691a305e85e22e1b8 100644 (file)
@@ -207,7 +207,7 @@ ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
     }
 
     if (r->limit_rate) {
-        limit = r->limit_rate * (ngx_time() - r->start_sec + 1)
+        limit = (off_t) r->limit_rate * (ngx_time() - r->start_sec + 1)
                 - (c->sent - clcf->limit_rate_after);
 
         if (limit <= 0) {