[njs] Fixed typo while calculating module path length.

Dmitry Volyntsev xeioex at nginx.com
Mon Apr 11 23:18:05 UTC 2022


details:   https://hg.nginx.org/njs/rev/d3ac18fd1cda
branches:  
changeset: 1834:d3ac18fd1cda
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Mon Apr 11 15:55:14 2022 -0700
description:
Fixed typo while calculating module path length.

The issue was introduced in 77c398f26d7e (not released yet).

diffstat:

 src/njs_module.c                   |  2 +-
 test/js/import_very_long_path.t.js |  9 +++++++++
 2 files changed, 10 insertions(+), 1 deletions(-)

diffs (25 lines):

diff -r 07ef6c1f04f1 -r d3ac18fd1cda src/njs_module.c
--- a/src/njs_module.c	Mon Mar 28 16:22:17 2022 +0000
+++ b/src/njs_module.c	Mon Apr 11 15:55:14 2022 -0700
@@ -118,7 +118,7 @@ njs_module_path(njs_vm_t *vm, const njs_
     length = info->name.length;
 
     if (dir != NULL) {
-        length = dir->length;
+        length += dir->length;
 
         if (length == 0) {
             return NJS_DECLINED;
diff -r 07ef6c1f04f1 -r d3ac18fd1cda test/js/import_very_long_path.t.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/js/import_very_long_path.t.js	Mon Apr 11 15:55:14 2022 -0700
@@ -0,0 +1,9 @@
+/*---
+: []
+paths: [test/js/module/]
+negative:
+  phase: runtime
+---*/
+
+import name from 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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