mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 07:58:45 +03:00
Remove unsafe regex in trim() function
`trim()` function contains a regular expression that is vulnerable to ReDoS but was uncaught by `safe-regex` module.
This commit is contained in:
parent
a886604935
commit
a6140a17dd
@ -93,7 +93,7 @@
|
|||||||
},
|
},
|
||||||
trim = function (str, len) {
|
trim = function (str, len) {
|
||||||
if (typeof(str) === STR_TYPE) {
|
if (typeof(str) === STR_TYPE) {
|
||||||
str = str.replace(/^\s\s*/, EMPTY).replace(/\s\s*$/, EMPTY);
|
str = str.replace(/^\s\s*/, EMPTY);
|
||||||
return typeof(len) === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);
|
return typeof(len) === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user