Changeset 11128 in ntrip for trunk/BNC/src/bncrawfile.cpp


Ignore:
Timestamp:
Oct 24, 2026, 11:37:52 PM (2 weeks ago)
Author:
stuerze
Message:

Some fixes from security point of view

File:
1 edited

Legend:

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

    r11021 r11128  
    138138      BNC_CORE->setDateAndTimeGPS(QDateTime(QDateTime::fromString(lst.value(0), Qt::ISODate)));
    139139     
     140      // the station ID becomes part of output file names: no path separators
    140141      _staID  = lst.value(1).toLatin1();
     142      for (int ii = 0; ii < _staID.size(); ii++) {
     143        if (_staID[ii] == '/' || _staID[ii] == '\\' || (unsigned char)_staID[ii] < 0x20) {
     144          _staID[ii] = '_';
     145        }
     146      }
    141147      _format = lst.value(2).toLatin1();
    142       int nBytes = lst.value(3).toInt();
    143      
     148      bool ok;
     149      int nBytes = lst.value(3).trimmed().toInt(&ok);
     150      if (!ok || nBytes < 0 || nBytes > (1 << 24)) {
     151        BNC_CORE->slotMessage("Raw file: invalid chunk header: " + line.trimmed().left(80).toLatin1(), true);
     152        return data;
     153      }
     154
    144155      data = _inpFile->read(nBytes);
    145156     
Note: See TracChangeset for help on using the changeset viewer.