fix: a DICT crash caused by string out of bound access
Some checks are pending
SonarCloud / Build and analyze (push) Waiting to run

This commit is contained in:
shenleban tongying 2024-11-12 16:32:32 -05:00
parent fbec70e41a
commit 6865b02547

View file

@ -538,12 +538,14 @@ void DictServerWordSearchRequest::readMatchData( QByteArray & reply )
if ( word.endsWith( '\"' ) ) { if ( word.endsWith( '\"' ) ) {
word.chop( 1 ); word.chop( 1 );
} }
if ( word[ 0 ] == '\"' ) { if ( word.startsWith( '\"' ) ) {
word = word.mid( 1 ); word = word.remove( 0, 1 );
} }
if ( !word.isEmpty() ) {
this->addMatchedWord( word ); this->addMatchedWord( word );
} }
}
reply = this->dictImpl->socket.readLine(); reply = this->dictImpl->socket.readLine();