]> git.kaiwu.me - nginx.git/commitdiff
Range filter: avoid negative range start.
authorMaxim Dounin <mdounin@mdounin.ru>
Tue, 11 Jul 2017 13:06:26 +0000 (16:06 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Tue, 11 Jul 2017 13:06:26 +0000 (16:06 +0300)
Suffix ranges no longer allowed to set negative start values, to prevent
ranges with negative start from appearing even if total size protection
will be removed.

src/http/modules/ngx_http_range_filter_module.c

index ac910fdfed535d1638ef54720d33801bbd3ae0fb..292a2b86327cda9f3248717b7572639f73d168d3 100644 (file)
@@ -355,7 +355,7 @@ ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx,
         }
 
         if (suffix) {
-            start = content_length - end;
+            start = (end < content_length) ? content_length - end : 0;
             end = content_length - 1;
         }