Sanitise strings printed when received from target control/remote server

* Given socket corruption or network errors these strings could contain
  unprintable characters so we sanitise them reasonably. This also ameliorates a
  potential security concern with arbitrary strings being written to a log, but
  these connections are still considered trusted and users should not be
  exposing RenderDoc ports to the internet.
This commit is contained in:
baldurk
2023-05-19 10:28:58 +01:00
parent e0464fea4f
commit 1f72a09e3b
5 changed files with 47 additions and 12 deletions
+12
View File
@@ -141,6 +141,18 @@ rdcstr strip_extension(const rdcstr &path)
return path.substr(0, offs);
}
rdcstr strip_nonbasic(rdcstr &str)
{
for(char &c : str)
{
if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '.' ||
c == ' ')
continue;
c = '_';
}
}
void split(const rdcstr &in, rdcarray<rdcstr> &out, const char sep)
{
if(in.empty())