changeset 2622:a708e9f87973

Fixed potential heap-use-after-free in njs_vm_compile_module(). Passing a local copy of name argument to njs_parser_init().
author Dmitry Volyntsev <xeioex@nginx.com>
date Wed, 01 Oct 2025 20:10:43 -0700
parents 80c6090a64d4
children 75221283a3e2
files src/njs_vm.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/njs_vm.c	Mon Sep 29 22:43:11 2025 -0700
+++ b/src/njs_vm.c	Wed Oct 01 20:10:43 2025 -0700
@@ -327,7 +327,7 @@
         return NULL;
     }
 
-    ret = njs_parser_init(vm, &parser, NULL, name, *start, end);
+    ret = njs_parser_init(vm, &parser, NULL, &module->name, *start, end);
     if (njs_slow_path(ret != NJS_OK)) {
         return NULL;
     }