Fix potential UB in creation of sdbus::Error.

See https://github.com/Kistler-Group/sdbus-cpp/issues/231
This commit is contained in:
Benjamin Kaufmann
2022-01-11 19:01:22 +01:00
committed by Stanislav Angelovič
parent bca8e81037
commit f673e57a47
2 changed files with 23 additions and 0 deletions
+5
View File
@@ -43,6 +43,11 @@ namespace sdbus {
: public std::runtime_error
{
public:
explicit Error(const std::string& name, const char* message = nullptr)
: Error(name, std::string(message ? message : ""))
{
}
Error(const std::string& name, const std::string& message)
: std::runtime_error("[" + name + "] " + message)
, name_(name)