From 17faf562629cd27f00fc138e218ebcc1ce071765 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Sat, 2 Nov 2013 05:27:42 +1000 Subject: Refactor: pull alert string sanitization into util --- src/alert.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/alert.cpp') diff --git a/src/alert.cpp b/src/alert.cpp index b900fe41e5..7f7e59ee10 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -241,15 +241,7 @@ bool CAlert::ProcessAlert(bool fThread) // be safe we first strip anything not in safeChars, then add single quotes around // the whole string before passing it to the shell: std::string singleQuote("'"); - // safeChars chosen to allow simple messages/URLs/email addresses, but avoid anything - // even possibly remotely dangerous like & or > - std::string safeChars("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890 .,;_/:?@"); - std::string safeStatus; - for (std::string::size_type i = 0; i < strStatusBar.size(); i++) - { - if (safeChars.find(strStatusBar[i]) != std::string::npos) - safeStatus.push_back(strStatusBar[i]); - } + std::string safeStatus = SanitizeString(strStatusBar); safeStatus = singleQuote+safeStatus+singleQuote; boost::replace_all(strCmd, "%s", safeStatus); -- cgit v1.2.3