From bf1a3e5e4af52a1ac1fc9588244e5f22234856cf Mon Sep 17 00:00:00 2001 From: Peter L Jones Date: Tue, 1 Jun 2021 08:34:38 +0100 Subject: [PATCH] New lines are illegal --- src/serverlist.cpp | 7 ++++--- src/serverlist.h | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/serverlist.cpp b/src/serverlist.cpp index 97cb1e53e5..8e38c18439 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -36,7 +36,8 @@ CServerListManager::CServerListManager ( const quint16 iNPortNum, strMinServerVersion ( "" ), // disable version check with empty version pConnLessProtocol ( pNConLProt ), eSvrRegStatus ( SRS_UNREGISTERED ), - iSvrRegRetries ( 0 ) + iSvrRegRetries ( 0 ), + reIllegal ( "\n" ) { // set the directory server address SetCentralServerAddress ( sNCentServAddr ); @@ -87,10 +88,10 @@ CServerListManager::CServerListManager ( const quint16 iNPortNum, if ( iServInfoNumSplitItems >= 3 ) { // [this server name] - ThisServerListEntry.strName = slServInfoSeparateParams[0].left ( MAX_LEN_SERVER_NAME ); + ThisServerListEntry.strName = slServInfoSeparateParams[0].remove ( reIllegal ).left ( MAX_LEN_SERVER_NAME ); // [this server city] - ThisServerListEntry.strCity = slServInfoSeparateParams[1].left ( MAX_LEN_SERVER_CITY ); + ThisServerListEntry.strCity = slServInfoSeparateParams[1].remove ( reIllegal ).left ( MAX_LEN_SERVER_CITY ); // [this server country as QLocale ID] const int iCountry = slServInfoSeparateParams[2].toInt(); diff --git a/src/serverlist.h b/src/serverlist.h index 6e635157b5..5d22bac5d8 100644 --- a/src/serverlist.h +++ b/src/serverlist.h @@ -203,6 +203,9 @@ class CServerListManager : public QObject // count of registration retries int iSvrRegRetries; + // Strip illegal characters + const QRegExp reIllegal; + public slots: void OnTimerPollList(); void OnTimerPingServerInList();