Changeset 11052 in ntrip for trunk/BNC/src/pppMain.cpp


Ignore:
Timestamp:
Sep 28, 2026, 9:55:56 PM (16 hours ago)
Author:
stuerze
Message:

reject malformed entries

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/pppMain.cpp

    r11022 r11052  
    4545#include "pppCrdFile.h"
    4646#include "bncsettings.h"
     47#include "bnccore.h"
    4748
    4849using namespace BNC_PPP;
    … …  
    8586  }
    8687  catch (t_except exc) {
     88    BNC_CORE->slotMessage(QByteArray::fromStdString(exc.what()), true);
    8789    _running = true;
    8890    stop();
    … …  
    161163    opt->_realTime     = _realTime;
    162164    opt->_roverName    = hlp[0].toStdString();
    163     opt->_aprSigCrd[0] = hlp[1].toDouble()+1e-10;
    164     opt->_aprSigCrd[1] = hlp[2].toDouble()+1e-10;
    165     opt->_aprSigCrd[2] = hlp[3].toDouble()+1e-10;
    166     opt->_noiseCrd[0]  = hlp[4].toDouble()+1e-10;
    167     opt->_noiseCrd[1]  = hlp[5].toDouble()+1e-10;
    168     opt->_noiseCrd[2]  = hlp[6].toDouble()+1e-10;
    169     opt->_aprSigTrp    = hlp[7].toDouble();
    170     opt->_noiseTrp     = hlp[8].toDouble();
    171     opt->_nmeaPort     = hlp[9].toInt();
     165
     166    // Numeric Fields: reject malformed entries
     167    // ----------------------------------------
     168    double num[9];
     169    for (int ii = 1; ii <= 8; ii++) {
     170      bool ok;
     171      num[ii] = hlp[ii].trimmed().toDouble(&ok);
     172      if (!ok || num[ii] < 0.0) {
     173        std::string msg = "pppMain: wrong option staTable: station "
     174                        + opt->_roverName + " field " + std::to_string(ii)
     175                        + " \"" + hlp[ii].toStdString() + "\"";
     176        delete opt;
     177        throw t_except(msg.c_str());
     178      }
     179    }
     180    bool okPort;
     181    int nmeaPort = hlp[9].trimmed().toInt(&okPort);
     182    if (!okPort && !hlp[9].trimmed().isEmpty()) {
     183      std::string msg = "pppMain: wrong option staTable: station "
     184                      + opt->_roverName + " NMEA port \""
     185                      + hlp[9].toStdString() + "\"";
     186      delete opt;
     187      throw t_except(msg.c_str());
     188    }
     189
     190    opt->_aprSigCrd[0] = num[1]+1e-10;
     191    opt->_aprSigCrd[1] = num[2]+1e-10;
     192    opt->_aprSigCrd[2] = num[3]+1e-10;
     193    opt->_noiseCrd[0]  = num[4]+1e-10;
     194    opt->_noiseCrd[1]  = num[5]+1e-10;
     195    opt->_noiseCrd[2]  = num[6]+1e-10;
     196    opt->_aprSigTrp    = num[7];
     197    opt->_noiseTrp     = num[8];
     198    opt->_nmeaPort     = nmeaPort;
    172199
    173200    string trkStr      = hlp[10].trimmed().toStdString();
Note: See TracChangeset for help on using the changeset viewer.