Fix a QStringList bounds error in auto-sequencing

This commit is contained in:
Bill Somerville 2020-04-22 18:32:00 +01:00
parent db7d3e93f7
commit e51bfc8397
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F

View File

@ -3367,12 +3367,16 @@ void MainWindow::auto_sequence (DecodedText const& message, unsigned start_toler
|| !message.isStandardMessage ()); // free text 73/RR73 || !message.isStandardMessage ()); // free text 73/RR73
QStringList w=message.string().mid(22).remove("<").remove(">").split(" ",QString::SkipEmptyParts); QStringList w=message.string().mid(22).remove("<").remove(">").split(" ",QString::SkipEmptyParts);
QString w2=w.at(2); QString w2;
int nrpt=0; int nrpt=0;
if (w.size () > 2)
{
w2=w.at(2);
if(w.size()>3) { if(w.size()>3) {
nrpt=w2.toInt(); nrpt=w2.toInt();
if(w2=="R") nrpt=w.at(3).toInt(); if(w2=="R") nrpt=w.at(3).toInt();
} }
}
bool bEU_VHF=(nrpt>=520001 and nrpt<=594000); bool bEU_VHF=(nrpt>=520001 and nrpt<=594000);
if(bEU_VHF and message.string().contains("<"+m_config.my_callsign() + "> ")) { if(bEU_VHF and message.string().contains("<"+m_config.my_callsign() + "> ")) {
m_xRcvd=message.string().trimmed().right(13); m_xRcvd=message.string().trimmed().right(13);
@ -4574,9 +4578,9 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie
|| (firstcall == "DE")) { || (firstcall == "DE")) {
QStringList w=message.string().mid(24).remove("<").remove(">").split(" ",QString::SkipEmptyParts); QStringList w=message.string().mid(24).remove("<").remove(">").split(" ",QString::SkipEmptyParts);
QString w2=""; QString w2;
if(w.size()>=3) w2=w.at(2); if(w.size()>=3) w2=w.at(2);
QString w34=""; QString w34;
if(w.size()>=4) w34=w.at(3); if(w.size()>=4) w34=w.at(3);
int nrpt=w2.toInt(); int nrpt=w2.toInt();
if(w2=="R") { if(w2=="R") {