changeset 7154:595a3de03e91

Xslt: fixed parameters parsing (ticket #1416). If parameters were specified in xslt_stylesheet without variables, any request except the first would cause an internal server error.
author Ruslan Ermilov <ru@nginx.com>
date Thu, 16 Nov 2017 13:20:47 +0300
parents 32f83fe5747b
children 29e9571b1989
files src/http/modules/ngx_http_xslt_filter_module.c
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_xslt_filter_module.c
+++ b/src/http/modules/ngx_http_xslt_filter_module.c
@@ -686,8 +686,19 @@ ngx_http_xslt_params(ngx_http_request_t 
          * specified in xslt_stylesheet directives
          */
 
-        p = string.data;
-        last = string.data + string.len;
+        if (param[i].value.lengths) {
+            p = string.data;
+
+        } else {
+            p = ngx_pnalloc(r->pool, string.len + 1);
+            if (p == NULL) {
+                return NGX_ERROR;
+            }
+
+            ngx_memcpy(p, string.data, string.len + 1);
+        }
+
+        last = p + string.len;
 
         while (p && *p) {