]> git.kaiwu.me - nginx.git/commitdiff
fix segfault when $date_local or $date_gmt are used outside ssi module
authorIgor Sysoev <igor@sysoev.ru>
Sun, 14 Oct 2007 19:04:23 +0000 (19:04 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sun, 14 Oct 2007 19:04:23 +0000 (19:04 +0000)
src/http/modules/ngx_http_ssi_filter_module.c

index 8a05dfd4e83f55dde4f123d2c2b03105a84174e4..60aed18f895a470a58ff6534d0e27e0be68a071a 100644 (file)
@@ -2648,8 +2648,9 @@ ngx_http_ssi_date_gmt_local_variable(ngx_http_request_t *r,
 
     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) {