Skip to content

Commit

Permalink
Minor mitigation
Browse files Browse the repository at this point in the history
  • Loading branch information
mde committed May 11, 2022
1 parent 820855a commit 551949d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
'use strict';

var regExpChars = /[|\\{}()[\]^$+*?.]/g;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var hasOwn = function (obj, key) { return hasOwnProperty.apply(obj, [key]); };

/**
* Escape characters reserved in regular expressions.
Expand Down Expand Up @@ -116,6 +118,12 @@ exports.shallowCopy = function (to, from) {
from = from || {};
if ((to !== null) && (to !== undefined)) {
for (var p in from) {
if (!hasOwn(from, p)) {
continue;
}
if (p === '__proto__' || p === 'constructor') {
continue;
}
to[p] = from[p];
}
}
Expand All @@ -141,6 +149,12 @@ exports.shallowCopyFromList = function (to, from, list) {
for (var i = 0; i < list.length; i++) {
var p = list[i];
if (typeof from[p] != 'undefined') {
if (!hasOwn(from, p)) {
continue;
}
if (p === '__proto__' || p === 'constructor') {
continue;
}
to[p] = from[p];
}
}
Expand Down

0 comments on commit 551949d

Please sign in to comment.