From 866e6c59298fc894d6198c84d19598befee22470 Mon Sep 17 00:00:00 2001 From: Erik Date: Tue, 4 Aug 2020 22:00:01 +0200 Subject: [PATCH] replace % by %25 while building appcmd command --- src/ServiceMonitor/IISConfigUtil.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ServiceMonitor/IISConfigUtil.cpp b/src/ServiceMonitor/IISConfigUtil.cpp index 7342147..19bb5f9 100644 --- a/src/ServiceMonitor/IISConfigUtil.cpp +++ b/src/ServiceMonitor/IISConfigUtil.cpp @@ -163,6 +163,11 @@ HRESULT IISConfigUtil::BuildAppCmdCommand(const vector>& Replace(strEnvName, L"\"", L"\"\"\""); Replace(strEnvValue, L"'", L"''"); Replace(strEnvValue, L"\"", L"\"\"\""); + + // + // Handle values with a % sign, appcmd interprets these as hex characters + // + Replace(strEnvValue, L"%", L"%25"); if ((pStrCmd.length() + strEnvName.length() + strEnvValue.length()) > APPCMD_MAX_SIZE) {