summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucio M. Tato <luciotato@gmail.com>2014-08-02 02:33:35 -0300
committerTrevor Norris <trev.norris@gmail.com>2014-08-02 00:19:20 -0700
commit37c2a528336b41b31abe4826b308071896e42423 (patch)
tree2e4711f6d158eb202327bd75cbc977bc80720b73
parentaab126bb0604a0159ebc139644a71407661aa6fc (diff)
downloadandroid-node-v8-37c2a528336b41b31abe4826b308071896e42423.tar.gz
android-node-v8-37c2a528336b41b31abe4826b308071896e42423.tar.bz2
android-node-v8-37c2a528336b41b31abe4826b308071896e42423.zip
path: fix slice OOB in trim
Internal function trim(arr). 2nd parameter of slice() should be slice's end index (not included). Because of function normalize() (called before trim()), "start" is always zero so the bug -for now- has no effect, but its a bug waiting to happen. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
-rw-r--r--lib/path.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/path.js b/lib/path.js
index 768c4c1e5b..04187aaf2f 100644
--- a/lib/path.js
+++ b/lib/path.js
@@ -269,7 +269,7 @@ if (isWindows) {
}
if (start > end) return [];
- return arr.slice(start, end - start + 1);
+ return arr.slice(start, end + 1);
}
var toParts = trim(to.split('\\'));
@@ -413,7 +413,7 @@ if (isWindows) {
}
if (start > end) return [];
- return arr.slice(start, end - start + 1);
+ return arr.slice(start, end + 1);
}
var fromParts = trim(from.split('/'));