From: Gunnar Beutner Date: Fri, 30 Aug 2013 14:52:13 +0000 (+0200) Subject: Fix shell escaping in the macro processor. X-Git-Tag: v0.0.3~635 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8df0525e3ef58a606d5f0143f2ffc0b7a9fe826d;p=icinga2 Fix shell escaping in the macro processor. --- diff --git a/lib/icinga/macroprocessor.cpp b/lib/icinga/macroprocessor.cpp index dcb0caf56..a084e161d 100644 --- a/lib/icinga/macroprocessor.cpp +++ b/lib/icinga/macroprocessor.cpp @@ -94,12 +94,12 @@ String MacroProcessor::InternalResolveMacros(const String& str, const std::vecto if (!found) Log(LogWarning, "icinga", "Macro '" + name + "' is not defined."); + if (escapeFn) + resolved_macro = escapeFn(resolvedMacro); + result.Replace(pos_first, pos_second - pos_first + 1, resolved_macro); offset = pos_first + resolved_macro.GetLength(); } - if (escapeFn) - result = escapeFn(result); - return result; }