openpower-pels: src: remove use of VLA

Clean up the following warning by rewriting the reported loop to
use C++ string iterators rather than a string copy into a VLA.

    ../extensions/openpower-pels/src.cpp:489:18: error: ISO C++ forbids
    variable length array ‘msg’ [-Werror=vla]
  489 |             char msg[msgLen + 1];
      |                  ^~~

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I0c61ab52a9cdf78ace6a1ff90109cdc1f54194c6
diff --git a/extensions/openpower-pels/src.cpp b/extensions/openpower-pels/src.cpp
index e41de8c..0bbc61f 100644
--- a/extensions/openpower-pels/src.cpp
+++ b/extensions/openpower-pels/src.cpp
@@ -481,9 +481,6 @@
     {
         if (regEntry.doc.messageArgSources)
         {
-            size_t msgLen = regEntry.doc.message.length();
-            char msg[msgLen + 1];
-            strcpy(msg, regEntry.doc.message.c_str());
             std::vector<uint32_t> argSourceVals;
             std::string message;
             const auto& argValues = regEntry.doc.messageArgSources.value();
@@ -492,14 +489,18 @@
                 argSourceVals.push_back(_hexData[getWordIndexFromWordNum(
                     argValues[i].back() - '0')]);
             }
-            const char* msgPointer = msg;
-            while (*msgPointer)
+
+            auto it = std::begin(regEntry.doc.message);
+            auto it_end = std::end(regEntry.doc.message);
+
+            while (it != it_end)
             {
-                if (*msgPointer == '%')
+                if (*it == '%')
                 {
-                    msgPointer++;
-                    size_t wordIndex = *msgPointer - '0';
-                    if (isdigit(*msgPointer) && wordIndex >= 1 &&
+                    ++it;
+
+                    size_t wordIndex = *it - '0';
+                    if (isdigit(*it) && wordIndex >= 1 &&
                         static_cast<uint16_t>(wordIndex) <=
                             argSourceVals.size())
                     {
@@ -508,15 +509,16 @@
                     }
                     else
                     {
-                        message.append("%" + std::string(1, *msgPointer));
+                        message.append("%" + std::string(1, *it));
                     }
                 }
                 else
                 {
-                    message.push_back(*msgPointer);
+                    message.push_back(*it);
                 }
-                msgPointer++;
+                ++it;
             }
+
             return message;
         }
         else