diff options
author | Matt Spinler <spinler@us.ibm.com> | 2020-02-12 16:05:51 -0600 |
---|---|---|
committer | Matt Spinler <spinler@us.ibm.com> | 2020-02-17 17:19:10 +0000 |
commit | 5b56182b9699074dd77551a13069e978e81a9c68 (patch) | |
tree | 90e724224b1cb17aec3efa5b9e140f0008ff2646 /extensions/openpower-pels/ascii_string.cpp | |
parent | 945299f077adb1b138b6507d1a3943415d6c2079 (diff) | |
download | phosphor-logging-master.tar.gz phosphor-logging-master.zip |
This field may be displayed by things like a web UI and LCD panel, so
on unflattening convert any disallowed characters to a space.
Only allow: alphanumeric, '.', ':', '/', ' '.
When a host PEL is received, the PEL will be unflattened and reflattened
when the commit timestamp and PLID are modified, and this will be fixed
up then.
This matches other service processor implementations that dealt with
PELs.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I7afe64e199ebd2448b54e4ba5769de436d30b9ba
Diffstat (limited to 'extensions/openpower-pels/ascii_string.cpp')
-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 |