From d7b6a38c012c6bdbc60d0e7bd482cbe8ea376081 Mon Sep 17 00:00:00 2001 From: Dongkyun Son Date: Thu, 9 May 2024 11:53:36 +0900 Subject: [PATCH] regex: fix invalid start of '[x-x]' range Fix terminate called after throwing an instance of 'std::regex_error' what(): Invalid start of '[x-x]' range in regular expression Change-Id: I97a7f57da8869d47400bfca26bfc5ff839fc0fa4 --- src/trigger/CustomTemplate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trigger/CustomTemplate.cpp b/src/trigger/CustomTemplate.cpp index 06136c0..7e746d4 100644 --- a/src/trigger/CustomTemplate.cpp +++ b/src/trigger/CustomTemplate.cpp @@ -246,7 +246,7 @@ bool CustomTemplate::checkTemplateEnum(const Json::Value& elem) int CustomTemplate::add(const std::string& name, const std::string& attrTmpl) { - static std::regex nameRegex(R"~(^[\w-\._\/]+$)~", std::regex::optimize); + static std::regex nameRegex(R"~(^[\w\-\._\/]+$)~", std::regex::optimize); IF_FAIL_RETURN_TAG(std::regex_match(name, nameRegex), CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER, _E, "Invalid name"); Json::Value tmplJson; -- 2.34.1