PEL: Sanitize the SRC ASCII string field

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
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::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