From d289616b0fb452f7dd4cbb4534c706950e3d6c24 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Tue, 11 Jul 2017 16:06:26 +0300 Subject: [PATCH] Range filter: avoid negative range start. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http/modules/ngx_http_range_filter_module.c b/src/http/modules/ngx_http_range_filter_module.c index ac910fdfe..292a2b863 100644 --- a/src/http/modules/ngx_http_range_filter_module.c +++ b/src/http/modules/ngx_http_range_filter_module.c @@ -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; }