HomePhabricator

[Backport]util: Filter control characters out of log messages

Description

[Backport]util: Filter control characters out of log messages

Summary:
Belts and suspenders: make sure outgoing log messages don't contain
potentially suspicious characters, such as terminal control codes.

This escapes control characters except newline ('\n') in C syntax.
It escapes instead of removes them to still allow for troubleshooting
issues where they accidentally end up in strings.

Backport of Bitcoin Core PR17095

Test Plan: ninja && ninja check

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7517

Details

Provenance
Wladimir J. van der Laan <laanwj@protonmail.com>Authored on Oct 10 2019, 11:25
PiRKCommitted on Sep 22 2020, 14:54
PiRKPushed on Sep 22 2020, 14:54
Reviewer
Restricted Owners Package
Differential Revision
D7517: [Backport]util: Filter control characters out of log messages
Parents
rABCf498cf0abbf5: Remove extra CBlockIndex declaration
Branches
Unknown
Tags
Unknown