diff --git a/ngx_http_let_module.c b/ngx_http_let_module.c index c9be20c..4c82676 100644 --- a/ngx_http_let_module.c +++ b/ngx_http_let_module.c @@ -518,6 +518,9 @@ static char* ngx_http_let_let(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ngx_log_debug0(NGX_LOG_INFO, cf->log, 0, "let command handler"); + if (value[1].len <= 1) + return "needs variable name"; + if (value[1].data[0] != '$') return "needs variable as the first argument"; diff --git a/t/crash.t b/t/crash.t new file mode 100644 index 0000000..35181a7 --- /dev/null +++ b/t/crash.t @@ -0,0 +1,22 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; # 'no_plan'; + +repeat_each(1); + +plan tests => repeat_each() * 2 * blocks(); + +run_tests(); + +__DATA__ + +=== TEST 1: simple calc +--- config + location /let { + let $ a 1; + } +--- request +GET /let +--- error_log: directive needs variable name +--- must_die