Welcome! Log In Create A New Profile

Advanced

[njs] Modules: adding NUL byte at the end of the global script.

Anonymous User
August 16, 2024 11:28AM
details: https://github.com/nginx/njs/commit/58b581461d8cc77037de9000e1dde9b74e314aee
branches: master
commit: 58b581461d8cc77037de9000e1dde9b74e314aee
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Thu, 25 Jul 2024 19:02:35 -0700
description:
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).

---
nginx/ngx_js.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

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;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Modules: adding NUL byte at the end of the global script.

Anonymous User 142 August 16, 2024 11:28AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 88
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready