Add CodeQL for GitHub code scanning (#1548)

* Create codeql.yml

* Addressing codeql findings
This commit is contained in:
LordGrey
2022-12-27 08:36:10 +01:00
committed by GitHub
parent 1189f86c1a
commit 6fa7bab6f7
83 changed files with 1984 additions and 2094 deletions

View File

@@ -77,13 +77,13 @@ void QtHttpClientWrapper::onClientDataReceived (void)
else
{
m_parsingStatus = ParsingError;
//qWarning () << "Error : unhandled HTTP version :" << version;
// Error : unhandled HTTP version
}
}
else
{
m_parsingStatus = ParsingError;
//qWarning () << "Error : incorrect HTTP command line :" << line;
// Error : incorrect HTTP command line
}
break;

View File

@@ -1,5 +1,7 @@
#include "StaticFileServing.h"
#include "QtHttpHeader.h"
#include <utils/QStringUtils.h>
#include <QStringBuilder>
@@ -9,6 +11,7 @@
#include <QFile>
#include <QFileInfo>
#include <QResource>
#include <exception>
StaticFileServing::StaticFileServing (QObject * parent)

View File

@@ -3,10 +3,8 @@
#include <QMimeDatabase>
//#include "QtHttpServer.h"
#include "QtHttpRequest.h"
#include "QtHttpReply.h"
#include "QtHttpHeader.h"
#include "CgiHandler.h"
#include <utils/Logger.h>

View File

@@ -58,14 +58,12 @@ void WebSocketClient::handleWebSocketFrame()
if(_socket->bytesAvailable() < (qint64)_wsh.payloadLength)
{
//printf("not enough data %llu %llu\n", _socket->bytesAvailable(), _wsh.payloadLength);
_notEnoughData=true;
return;
}
_notEnoughData = false;
QByteArray buf = _socket->read(_wsh.payloadLength);
//printf("opcode %x payload bytes %llu avail: %llu\n", _wsh.opCode, _wsh.payloadLength, _socket->bytesAvailable());
if (OPCODE::invalid((OPCODE::value)_wsh.opCode))
{
@@ -210,10 +208,10 @@ void WebSocketClient::getWsFrameHeader(WebSocketHeader* header)
}
/// See http://tools.ietf.org/html/rfc6455#section-5.2 for more information
void WebSocketClient::sendClose(int status, QString reason)
void WebSocketClient::sendClose(int status, const QString& reason)
{
Debug(_log, "Send close to %s: %d %s", QSTRING_CSTR(_socket->peerAddress().toString()), status, QSTRING_CSTR(reason));
ErrorIf(!reason.isEmpty(), _log, QSTRING_CSTR(reason));
ErrorIf(!reason.isEmpty(), _log, "%s", QSTRING_CSTR(reason));
_receiveBuffer.clear();
QByteArray sendBuffer;
@@ -244,8 +242,6 @@ void WebSocketClient::sendClose(int status, QString reason)
void WebSocketClient::handleBinaryMessage(QByteArray &data)
{
//uint8_t priority = data.at(0);
//unsigned duration_s = data.at(1);
unsigned imgSize = data.size() - 4;
unsigned width = ((data.at(2) << 8) & 0xFF00) | (data.at(3) & 0xFF);
unsigned height = imgSize / width;
@@ -260,8 +256,6 @@ void WebSocketClient::handleBinaryMessage(QByteArray &data)
image.resize(width, height);
memcpy(image.memptr(), data.data()+4, imgSize);
//_hyperion->registerInput();
//_hyperion->setInputImage(priority, image, duration_s*1000);
}

View File

@@ -31,7 +31,7 @@ private:
JsonAPI* _jsonAPI;
void getWsFrameHeader(WebSocketHeader* header);
void sendClose(int status, QString reason = "");
void sendClose(int status, const QString& reason = "");
void handleBinaryMessage(QByteArray &data);
qint64 sendMessage_Raw(const char* data, quint64 size);
qint64 sendMessage_Raw(QByteArray &data);