mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
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>
This commit is contained in:
committed by
Trevor Norris
parent
aab126bb06
commit
37c2a52833
@@ -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('/'));
|
||||
|
||||
Reference in New Issue
Block a user