# HG changeset patch # User Igor Sysoev # Date 1192388663 0 # Node ID f00b905cb70bda2cf2e5dc2caa98065db635cda8 # Parent 4c43e25d11ea95f0fc3a47203b1d92910cdd504e fix segfault when $date_local or $date_gmt are used outside ssi module diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c --- a/src/http/modules/ngx_http_ssi_filter_module.c +++ b/src/http/modules/ngx_http_ssi_filter_module.c @@ -2648,8 +2648,9 @@ ngx_http_ssi_date_gmt_local_variable(ngx ctx = ngx_http_get_module_ctx(r, ngx_http_ssi_filter_module); - if (ctx->timefmt.len == sizeof("%s") - 1 - && ctx->timefmt.data[0] == '%' && ctx->timefmt.data[1] == 's') + if (ctx == NULL + || (ctx->timefmt.len == sizeof("%s") - 1 + && ctx->timefmt.data[0] == '%' && ctx->timefmt.data[1] == 's')) { v->data = ngx_palloc(r->pool, NGX_TIME_T_LEN); if (v->data == NULL) {