Skip to content

Commit 40c73bf

Browse files
committedJan 19, 2022
Fix other instances of prototype pollution vulnerability
1 parent dfc753a commit 40c73bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎lib/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ function cachedPathRelative (from, to) {
2727
// to invalidate the cache
2828
var cwd = process.cwd()
2929
if (cwd !== lastCwd) {
30-
cache = {}
30+
cache = Object.create(null)
3131
lastCwd = cwd
3232
}
3333

3434
if (cache[from] && cache[from][to]) return cache[from][to]
3535

3636
var result = relative.call(path, from, to)
3737

38-
cache[from] = cache[from] || {}
38+
cache[from] = cache[from] || Object.create(null)
3939
cache[from][to] = result
4040

4141
return result

0 commit comments

Comments
 (0)
Please sign in to comment.