Skip to content

Commit cb4351c

Browse files
authored
Merge pull request #8 from 418sec/1-npm-arr-flatten-unflatten
Security Fix for Prototype Pollution - huntr.dev
2 parents f4ccf0a + 28bf435 commit cb4351c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

unflatten.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ function unflatten(obj = {}) {
1010
let m = {};
1111

1212
while ((m = regex.exec(p))) {
13+
if (curr[prop] === constructor.prototype)
14+
curr[prop] = {}
1315
curr = curr[prop] || (curr[prop] = m[2] ? [] : {});
1416
prop = m[2] || m[1];
1517
}

0 commit comments

Comments
 (0)