| 27 | using util::ReplaceAll; |
| 28 | |
| 29 | static void AlertNotify(const std::string &strMessage) { |
| 30 | uiInterface.NotifyAlertChanged(); |
| 31 | #if defined(HAVE_SYSTEM) |
| 32 | std::string strCmd = gArgs.GetArg("-alertnotify", ""); |
| 33 | if (strCmd.empty()) { |
| 34 | return; |
| 35 | } |
| 36 | |
| 37 | // Alert text should be plain ascii coming from a trusted source, but to be |
| 38 | // safe we first strip anything not in safeChars, then add single quotes |
| 39 | // around the whole string before passing it to the shell: |
| 40 | std::string singleQuote("'"); |
| 41 | std::string safeStatus = SanitizeString(strMessage); |
| 42 | safeStatus = singleQuote + safeStatus + singleQuote; |
| 43 | ReplaceAll(strCmd, "%s", safeStatus); |
| 44 | |
| 45 | std::thread t(runCommand, strCmd); |
| 46 | // thread runs free |
| 47 | t.detach(); |
| 48 | #endif |
| 49 | } |
| 50 | |
| 51 | namespace node { |
| 52 |
no test coverage detected