[nginx] SSI: return NGX_ERROR when timefmt memory allocation failed.

Sergey Kandaurov pluknet at nginx.com
Wed Jun 7 15:51:51 UTC 2017


details:   http://hg.nginx.org/nginx/rev/e699e6b6d76c
branches:  
changeset: 7026:e699e6b6d76c
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Wed Jun 07 15:21:42 2017 +0300
description:
SSI: return NGX_ERROR when timefmt memory allocation failed.

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().

diffstat:

 src/http/modules/ngx_http_ssi_filter_module.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 7206c3630310 -r e699e6b6d76c src/http/modules/ngx_http_ssi_filter_module.c
--- a/src/http/modules/ngx_http_ssi_filter_module.c	Fri Jun 02 15:05:32 2017 +0300
+++ b/src/http/modules/ngx_http_ssi_filter_module.c	Wed Jun 07 15:21:42 2017 +0300
@@ -2388,7 +2388,7 @@ ngx_http_ssi_config(ngx_http_request_t *
         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);


More information about the nginx-devel mailing list