[nginx] Range filter: avoid negative range start.

Maxim Dounin mdounin at mdounin.ru
Tue Jul 11 15:42:00 UTC 2017


details:   http://hg.nginx.org/nginx/rev/887c8c58ffeb
branches:  
changeset: 7055:887c8c58ffeb
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Tue Jul 11 16:06:26 2017 +0300
description:
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.

diffstat:

 src/http/modules/ngx_http_range_filter_module.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff --git a/src/http/modules/ngx_http_range_filter_module.c b/src/http/modules/ngx_http_range_filter_module.c
--- 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 
         }
 
         if (suffix) {
-            start = content_length - end;
+            start = (end < content_length) ? content_length - end : 0;
             end = content_length - 1;
         }
 


More information about the nginx-devel mailing list