diff options
| author | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2022-06-27 17:16:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-27 17:16:06 +0200 |
| commit | a055337a027cf52f6cd4c19eb80144ab99b00b58 (patch) | |
| tree | 905b8ad9b48163e8dcf7e7f14c8985a2ee58eae5 /lib/internal/validators.js | |
| parent | 411fb2172314588a6503f8f7aa14263b117c04df (diff) | |
| download | node-new-a055337a027cf52f6cd4c19eb80144ab99b00b58.tar.gz | |
lib: refactor to avoid unsafe regex primordials
PR-URL: https://github.com/nodejs/node/pull/43475
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Diffstat (limited to 'lib/internal/validators.js')
| -rw-r--r-- | lib/internal/validators.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/internal/validators.js b/lib/internal/validators.js index cda6b6bea0..5cca47129e 100644 --- a/lib/internal/validators.js +++ b/lib/internal/validators.js @@ -9,7 +9,7 @@ const { NumberMAX_SAFE_INTEGER, NumberMIN_SAFE_INTEGER, NumberParseInt, - RegExpPrototypeTest, + RegExpPrototypeExec, String, StringPrototypeToUpperCase, StringPrototypeTrim, @@ -58,7 +58,7 @@ const modeDesc = 'must be a 32-bit unsigned integer or an octal string'; function parseFileMode(value, name, def) { value ??= def; if (typeof value === 'string') { - if (!RegExpPrototypeTest(octalReg, value)) { + if (RegExpPrototypeExec(octalReg, value) === null) { throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc); } value = NumberParseInt(value, 8); |
