From: Dmitry Volyntsev Date: Fri, 18 Oct 2024 01:31:26 +0000 (-0700) Subject: HTTP: added strict check for js_body_filter syntax. X-Git-Tag: 0.8.7~4 X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=6ed70de1607fcf137cdfc120f68967f0bfd46829;p=njs.git HTTP: added strict check for js_body_filter syntax. --- diff --git a/nginx/ngx_http_js_module.c b/nginx/ngx_http_js_module.c index 6f026293..06429241 100644 --- a/nginx/ngx_http_js_module.c +++ b/nginx/ngx_http_js_module.c @@ -7921,20 +7921,24 @@ ngx_http_js_body_filter_set(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) jlcf->buffer_type = NGX_JS_STRING; - if (cf->args->nelts == 3 - && ngx_strncmp(value[2].data, "buffer_type=", 12) == 0) - { - if (ngx_strcmp(&value[2].data[12], "string") == 0) { - jlcf->buffer_type = NGX_JS_STRING; + if (cf->args->nelts == 3) { + if (ngx_strncmp(value[2].data, "buffer_type=", 12) == 0) { + if (ngx_strcmp(&value[2].data[12], "string") == 0) { + jlcf->buffer_type = NGX_JS_STRING; - } else if (ngx_strcmp(&value[2].data[12], "buffer") == 0) { - jlcf->buffer_type = NGX_JS_BUFFER; + } else if (ngx_strcmp(&value[2].data[12], "buffer") == 0) { + jlcf->buffer_type = NGX_JS_BUFFER; + } else { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid buffer_type value \"%V\", " + "it must be \"string\" or \"buffer\"", + &value[2]); + return NGX_CONF_ERROR; + } } else { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - "invalid buffer_type value \"%V\", " - "it must be \"string\" or \"buffer\"", - &value[2]); + "invalid parameter \"%V\"", &value[2]); return NGX_CONF_ERROR; } }