]> git.kaiwu.me - nginx.git/commitdiff
Cache: status must be less then 599 in *_cache_valid directives.
authorGena Makhomed <gmm@csdoc.com>
Mon, 24 Sep 2018 17:26:46 +0000 (20:26 +0300)
committerGena Makhomed <gmm@csdoc.com>
Mon, 24 Sep 2018 17:26:46 +0000 (20:26 +0300)
Previously, configurations with typo, for example

    fastcgi_cache_valid 200301 302 5m;

successfully pass configuration test. Adding check for status
codes > 599, and such configurations are now properly rejected.

src/http/ngx_http_file_cache.c

index 56866fa4e1183f7fc45845ba3510746189da0cb1..330833df6a3a5406921066155b54d3851e86f1f3 100644 (file)
@@ -2669,7 +2669,7 @@ ngx_http_file_cache_valid_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
         } else {
 
             status = ngx_atoi(value[i].data, value[i].len);
-            if (status < 100) {
+            if (status < 100 || status > 599) {
                 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
                                    "invalid status \"%V\"", &value[i]);
                 return NGX_CONF_ERROR;