aboutsummaryrefslogtreecommitdiff
path: root/nginx/ngx_js.c
diff options
context:
space:
mode:
authorDmitry Volyntsev <xeioex@nginx.com>2024-07-25 19:02:35 -0700
committerDmitry Volyntsev <xeioexception@gmail.com>2024-08-16 08:26:45 -0700
commit58b581461d8cc77037de9000e1dde9b74e314aee (patch)
tree459f4c6cf40e52a1d2e073ed9b9986e9b50f81cc /nginx/ngx_js.c
parentd1c615eaa208a4e7c92b661f8f7674e92f19aedf (diff)
downloadnjs-58b581461d8cc77037de9000e1dde9b74e314aee.tar.gz
njs-58b581461d8cc77037de9000e1dde9b74e314aee.zip
Modules: adding NUL byte at the end of the global script.
Even though QuickJS takes length as an argument, when parsing the code, it expects NUL byte at the end. This change is similar to 184d2a39cb5 (0.8.5).
Diffstat (limited to 'nginx/ngx_js.c')
-rw-r--r--nginx/ngx_js.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/nginx/ngx_js.c b/nginx/ngx_js.c
index b372feca..9a20a684 100644
--- a/nginx/ngx_js.c
+++ b/nginx/ngx_js.c
@@ -2017,7 +2017,7 @@ ngx_js_init_conf_vm(ngx_conf_t *cf, ngx_js_loc_conf_t *conf,
+ sizeof(" globalThis. = ;\n") - 1;
}
- start = ngx_pnalloc(cf->pool, size);
+ start = ngx_pnalloc(cf->pool, size + 1);
if (start == NULL) {
return NGX_ERROR;
}
@@ -2039,6 +2039,8 @@ ngx_js_init_conf_vm(ngx_conf_t *cf, ngx_js_loc_conf_t *conf,
p = ngx_cpymem(p, ";\n", sizeof(";\n") - 1);
}
+ *p = '\0';
+
file = ngx_cycle->conf_prefix;
options->file.start = file.data;