From 1ac6cbc4a65e415a9df15a914b71f5dd00e08874 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 7 Sep 2019 01:08:22 +0100 Subject: [PATCH] A bit more safety around control characters in strings. --- common/string.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/string.cpp b/common/string.cpp index 70ec1859b0..001656c920 100644 --- a/common/string.cpp +++ b/common/string.cpp @@ -57,6 +57,8 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext ) { if( c == '/' ) converted += "{slash}"; + else if( c == '\n' || c == '\r' ) + converted += ""; // drop else converted += c; } @@ -66,6 +68,8 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext ) converted += "{brace}"; else if( c == ':' ) converted += "{colon}"; + else if( c == '\n' || c == '\r' ) + converted += ""; // drop else converted += c; }