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

Some fixes from security point of view

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/upload/bncuploadcaster.cpp

    r11126 r11128  
    2424
    2525using namespace std;
     26
     27// Status line of the caster/proxy answer is "HTTP/1.x 200 ..." or "ICY 200 OK"
     28////////////////////////////////////////////////////////////////////////////
     29static bool statusOk(const QByteArray& ans) {
     30  QList<QByteArray> status = ans.left(ans.indexOf("\r\n")).split(' ');
     31  return status.size() >= 2 && status[1] == "200" &&
     32         (status[0].startsWith("HTTP/") || status[0] == "ICY");
     33}
    2634
    2735// Constructor
    … …  
    284292
    285293      QByteArray ans = _outSocket->readAll();
    286       if (ans.indexOf("200") == -1) {
     294      if (!statusOk(ans)) {
    287295        int l = ans.indexOf("\r\n", 0);
    288296        emit(newMessage("Proxy: Connection broken for " + _mountpoint.toLatin1() + "@" +
    … …  
    331339   QByteArray ans = _outSocket->readAll();
    332340
    333   if (ans.indexOf("200") == -1) {
     341  if (!statusOk(ans)) {
    334342    delete _outSocket; _outSocket = 0;
    335343    int l = ans.indexOf("\r\n", 0);
Note: See TracChangeset for help on using the changeset viewer.