diff options
-rw-r--r-- | extensions/openpower-pels/ascii_string.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/extensions/openpower-pels/ascii_string.cpp b/extensions/openpower-pels/ascii_string.cpp index 124bd0c..7d4d4f3 100644 --- a/extensions/openpower-pels/ascii_string.cpp +++ b/extensions/openpower-pels/ascii_string.cpp @@ -73,6 +73,15 @@ void AsciiString::flatten(Stream& stream) const void AsciiString::unflatten(Stream& stream) { stream.read(_string.data(), _string.size()); + + // Only allow certain ASCII characters as other entities will + // eventually want to display this. + std::for_each(_string.begin(), _string.end(), [](auto& c) { + if (!isalnum(c) && (c != ' ') && (c != '.') && (c != ':') && (c != '/')) + { + c = ' '; + } + }); } std::string AsciiString::get() const |