1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 05:15:43 +00:00

fix(DoS): specify timeout in Regex ctor

This isn't actually a "fix", the method may be slow by design if the source is lazily enumerated. SonarCloud, however, did not like this method not having an explicit timeout. If SonarCloud continues to complain, we'll just shut its mouth masking tape and throw it in the broom closet.
This commit is contained in:
Oliver Booth 2023-03-31 21:29:29 +01:00
parent e70781ef0f
commit ec266063f9
No known key found for this signature in database
GPG Key ID: 20BEB9DC87961025

View File

@ -72,7 +72,8 @@ public static class EnumerableExtensions
} }
#endif #endif
var regex = new Regex(pattern, RegexOptions.Compiled | (ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None)); var options = RegexOptions.Compiled | (ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None);
var regex = new Regex(pattern, options, Regex.InfiniteMatchTimeout);
foreach (string item in source) foreach (string item in source)
{ {