From 9b3d08ab6a0b192c485468a5909a78869814693f Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 3 Jul 2020 12:00:45 +0200 Subject: [PATCH] config: fix invalid usage of std::string::replace() --- lib/config.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/config.cpp b/lib/config.cpp index 0661af3ff..081dd6672 100644 --- a/lib/config.cpp +++ b/lib/config.cpp @@ -218,9 +218,9 @@ void Config::expandEnvVars() while (std::regex_search(text, match, env_re)) { auto const from = match[0]; auto const var_name = match[1].str().c_str(); - char * var_value = std::getenv(var_name); + char *var_value = std::getenv(var_name); - text.replace(from.first, from.second, var_value); + text.replace(from.first - text.begin(), from.second - from.first, var_value); logger->debug("Replace env var {} in \"{}\" with value \"{}\"", var_name, text, var_value);