]> git.kaiwu.me - nginx.git/commitdiff
SSI: return NGX_ERROR when timefmt memory allocation failed.
authorSergey Kandaurov <pluknet@nginx.com>
Wed, 7 Jun 2017 12:21:42 +0000 (15:21 +0300)
committerSergey Kandaurov <pluknet@nginx.com>
Wed, 7 Jun 2017 12:21:42 +0000 (15:21 +0300)
Previously, when using NGX_HTTP_SSI_ERROR, error was ignored in ssi processing,
thus timefmt could be accessed later in ngx_http_ssi_date_gmt_local_variable()
as part of "set" handler, or NULL format pointer could be passed to strftime().

src/http/modules/ngx_http_ssi_filter_module.c

index 6fb1fbe4588bfc981d175f41fe38f3d5e21af28d..b92ad4c02d13f3be8178c86129768b5a0aa1313e 100644 (file)
@@ -2388,7 +2388,7 @@ ngx_http_ssi_config(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx,
         ctx->timefmt.len = value->len;
         ctx->timefmt.data = ngx_pnalloc(r->pool, value->len + 1);
         if (ctx->timefmt.data == NULL) {
-            return NGX_HTTP_SSI_ERROR;
+            return NGX_ERROR;
         }
 
         ngx_cpystrn(ctx->timefmt.data, value->data, value->len + 1);