]> git.kaiwu.me - nginx.git/commitdiff
Xslt: fixed parameters parsing (ticket #1416).
authorRuslan Ermilov <ru@nginx.com>
Thu, 16 Nov 2017 10:20:47 +0000 (13:20 +0300)
committerRuslan Ermilov <ru@nginx.com>
Thu, 16 Nov 2017 10:20:47 +0000 (13:20 +0300)
If parameters were specified in xslt_stylesheet without variables,
any request except the first would cause an internal server error.

src/http/modules/ngx_http_xslt_filter_module.c

index fae5895508c9442391321b43231e0b2917334b87..ea7ce2a5c95a42829bcb429eeb14035752034088 100644 (file)
@@ -686,8 +686,19 @@ ngx_http_xslt_params(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx,
          * 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) {