File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -101,9 +101,15 @@ inline void rtrim(std::string &s) {
101101
102102void StringRpcServer::rpcHandler ()
103103{
104- alfDebugLog.info (" Request received on %s : %s" ,mServiceName .c_str (),getString ());
104+ // build a safe string from DIM input. Parent method getString() is unsafe, not guarateed to be nul-terminated
105+ std::string inputString;
106+ if (auto data = getString (); data && getSize () > 0 ) {
107+ inputString.assign (data, getSize ());
108+ }
109+
110+ alfDebugLog.info (" Request received on %s : %s" ,mServiceName .c_str (),inputString.c_str ());
105111 try {
106- auto returnValue = mCallback (std::string ( getString ()) );
112+ auto returnValue = mCallback (inputString );
107113 setDataString (makeSuccessString (returnValue), *this );
108114 rtrim (returnValue);
109115 alfDebugLog.info (" Request completed: %s" , returnValue.c_str ());
You can’t perform that action at this time.
0 commit comments