summaryrefslogtreecommitdiff
path: root/test/parallel/test-path-normalize.js
diff options
context:
space:
mode:
authorMichaƫl Zasso <targos@protonmail.com>2017-09-26 10:32:04 +0200
committerJames M Snell <jasnell@gmail.com>2017-09-26 14:59:54 -0700
commitcfee1c977867defa2866eebb23a9fabec4003f52 (patch)
tree6c1d0569059145ef8f6ec4e90fadb224bcd126c3 /test/parallel/test-path-normalize.js
parent05e4c1d6bcc6499c23d47b57f97038117341a5eb (diff)
downloadnode-new-cfee1c977867defa2866eebb23a9fabec4003f52.tar.gz
path: fix normalize paths ending with two dots
Fixes: https://github.com/nodejs/security/issues/147 PR-URL: https://github.com/nodejs-private/node-private/pull/94 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Doug Wilson <doug@somethingdoug.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'test/parallel/test-path-normalize.js')
-rw-r--r--test/parallel/test-path-normalize.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/parallel/test-path-normalize.js b/test/parallel/test-path-normalize.js
index db91432b3e..0820052446 100644
--- a/test/parallel/test-path-normalize.js
+++ b/test/parallel/test-path-normalize.js
@@ -23,6 +23,10 @@ assert.strictEqual(path.win32.normalize('bar\\foo..\\..'), 'bar');
assert.strictEqual(path.win32.normalize('bar\\foo..\\..\\baz'), 'bar\\baz');
assert.strictEqual(path.win32.normalize('bar\\foo..\\'), 'bar\\foo..\\');
assert.strictEqual(path.win32.normalize('bar\\foo..'), 'bar\\foo..');
+assert.strictEqual(path.win32.normalize('..\\foo..\\..\\..\\bar'),
+ '..\\..\\bar');
+assert.strictEqual(path.win32.normalize('..\\...\\..\\.\\...\\..\\..\\bar'),
+ '..\\..\\bar');
assert.strictEqual(path.posix.normalize('./fixtures///b/../b/c.js'),
'fixtures/b/c.js');
@@ -37,3 +41,6 @@ assert.strictEqual(path.posix.normalize('bar/foo../..'), 'bar');
assert.strictEqual(path.posix.normalize('bar/foo../../baz'), 'bar/baz');
assert.strictEqual(path.posix.normalize('bar/foo../'), 'bar/foo../');
assert.strictEqual(path.posix.normalize('bar/foo..'), 'bar/foo..');
+assert.strictEqual(path.posix.normalize('../foo../../../bar'), '../../bar');
+assert.strictEqual(path.posix.normalize('../.../.././.../../../bar'),
+ '../../bar');