owasp-modsecurity / ModSecurity

ModSecurity is an open source, cross platform web application firewall (WAF) engine for Apache, IIS and Nginx. It has a robust event-based programming language which provides protection from a range of attacks against web applications and allows for HTTP traffic monitoring, logging and real-time analysis.
https://www.modsecurity.org
Apache License 2.0
7.67k stars 1.54k forks source link

fix: Changed 'equal_range()' + loop by 'find()' in resolveFirst() methods #3117

Open airween opened 1 month ago

airween commented 1 month ago

This PR fixes SonarCloud issues in these files:

Summary: AnchoredSetVariable and InMemoryCollection types are derived from std::unordered_multimap.

Both type has a resolveFirst(key) method (AnchoredSetVariable, InMemoryCollection), which finds the first occurrence of key in the collection.

The current implemented version uses equal_range() (doc) to find the key in a loop, and breaks from that after first match. This C++ collection has another method to find it where we don't need any loop, that's the find() (doc).

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud