diff options
-rw-r--r-- | include/dbus_monitor.hpp | 4 | ||||
-rw-r--r-- | include/dbus_utility.hpp | 2 | ||||
-rw-r--r-- | include/openbmc_dbus_rest.hpp | 4 | ||||
-rw-r--r-- | redfish-core/lib/ethernet.hpp | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp index 46ef25e00e..4ecc4367d9 100644 --- a/include/dbus_monitor.hpp +++ b/include/dbus_monitor.hpp @@ -173,8 +173,8 @@ inline void requestRoutes(App& app) // These regexes derived on the rules here: // https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names - std::regex validPath("^/([A-Za-z0-9_]+/?)*$"); - std::regex validInterface( + static std::regex validPath("^/([A-Za-z0-9_]+/?)*$"); + static std::regex validInterface( "^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)+$"); for (const auto& thisPath : *paths) diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp index c863c30f94..f8e53f44af 100644 --- a/include/dbus_utility.hpp +++ b/include/dbus_utility.hpp @@ -103,7 +103,7 @@ using MapperEndPoints = std::vector<std::string>; inline void escapePathForDbus(std::string& path) { - const std::regex reg("[^A-Za-z0-9_/]"); + const static std::regex reg("[^A-Za-z0-9_/]"); std::regex_replace(path.begin(), path.begin(), path.end(), reg, "_"); } diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp index 51257642cb..0fbef04921 100644 --- a/include/openbmc_dbus_rest.hpp +++ b/include/openbmc_dbus_rest.hpp @@ -101,7 +101,7 @@ const constexpr char* forbiddenResDesc = inline bool validateFilename(const std::string& filename) { - std::regex validFilename(R"(^[\w\- ]+(\.?[\w\- ]*)$)"); + static std::regex validFilename(R"(^[\w\- ]+(\.?[\w\- ]*)$)"); return std::regex_match(filename, validFilename); } @@ -2562,7 +2562,7 @@ inline void requestRoutes(App& app) // Filename should be in alphanumeric, dot and underscore // Its based on phosphor-debug-collector application // dumpfile format - std::regex dumpFileRegex("[a-zA-Z0-9\\._]+"); + static std::regex dumpFileRegex("[a-zA-Z0-9\\._]+"); if (!std::regex_match(dumpFileName, dumpFileRegex)) { BMCWEB_LOG_ERROR << "Invalid dump filename " << dumpFileName; diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp index 31a379dbb9..330e68e482 100644 --- a/redfish-core/lib/ethernet.hpp +++ b/redfish-core/lib/ethernet.hpp @@ -949,7 +949,7 @@ inline bool isHostnameValid(const std::string& hostname) // MUST handle host names of up to 63 characters (RFC 1123) // labels cannot start or end with hyphens (RFC 952) // labels can start with numbers (RFC 1123) - const std::regex pattern( + const static std::regex pattern( "^[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9]$"); return std::regex_match(hostname, pattern); @@ -959,7 +959,7 @@ inline bool isDomainnameValid(const std::string& domainname) { // Can have multiple subdomains // Top Level Domain's min length is 2 character - const std::regex pattern( + const static std::regex pattern( "^([A-Za-z0-9][a-zA-Z0-9\\-]{1,61}|[a-zA-Z0-9]{1,30}\\.)*[a-zA-Z]{2,}$"); return std::regex_match(domainname, pattern); |