Prevent testimony messages containing "<" and ">".
This commit is contained in:
parent
a90dfd2005
commit
2a229541ef
@ -1905,6 +1905,15 @@ class AOClient : public QObject {
|
|||||||
*/
|
*/
|
||||||
bool checkPasswordRequirements(QString username, QString password);
|
bool checkPasswordRequirements(QString username, QString password);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if a testimony contains '<' or '>'.
|
||||||
|
*
|
||||||
|
* @param message The IC Message that might contain unproper symbols.
|
||||||
|
*
|
||||||
|
* @return True if it contains '<' or '>' symbols, otherwise false.
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool checkTestimonySymbols(QString message);
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
|
|
||||||
void AOClient::addStatement(QStringList packet)
|
void AOClient::addStatement(QStringList packet)
|
||||||
{
|
{
|
||||||
|
if (checkTestimonySymbols(packet[4])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
AreaData* area = server->areas[current_area];
|
AreaData* area = server->areas[current_area];
|
||||||
int c_statement = area->statement();
|
int c_statement = area->statement();
|
||||||
if (c_statement >= -1) {
|
if (c_statement >= -1) {
|
||||||
@ -38,9 +41,9 @@ void AOClient::addStatement(QStringList packet)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (area->testimonyRecording() == AreaData::TestimonyRecording::ADD) {
|
else if (area->testimonyRecording() == AreaData::TestimonyRecording::ADD) {
|
||||||
packet[14] = "1";
|
packet[14] = "1";
|
||||||
area->addStatement(c_statement, packet);
|
area->addStatement(c_statement, packet);
|
||||||
area->setTestimonyRecording(AreaData::TestimonyRecording::PLAYBACK);
|
area->setTestimonyRecording(AreaData::TestimonyRecording::PLAYBACK);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sendServerMessage("Unable to add more statements. The maximum amount of statements has been reached.");
|
sendServerMessage("Unable to add more statements. The maximum amount of statements has been reached.");
|
||||||
@ -51,6 +54,9 @@ void AOClient::addStatement(QStringList packet)
|
|||||||
|
|
||||||
QStringList AOClient::updateStatement(QStringList packet)
|
QStringList AOClient::updateStatement(QStringList packet)
|
||||||
{
|
{
|
||||||
|
if (checkTestimonySymbols(packet[4])) {
|
||||||
|
return packet;
|
||||||
|
}
|
||||||
AreaData* area = server->areas[current_area];
|
AreaData* area = server->areas[current_area];
|
||||||
int c_statement = area->statement();
|
int c_statement = area->statement();
|
||||||
area->setTestimonyRecording(AreaData::TestimonyRecording::PLAYBACK);
|
area->setTestimonyRecording(AreaData::TestimonyRecording::PLAYBACK);
|
||||||
@ -70,3 +76,13 @@ void AOClient::clearTestimony()
|
|||||||
AreaData* area = server->areas[current_area];
|
AreaData* area = server->areas[current_area];
|
||||||
area->clearTestimony();
|
area->clearTestimony();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AOClient::checkTestimonySymbols(QString message)
|
||||||
|
{
|
||||||
|
if (message.contains('>') || message.contains('<')) {
|
||||||
|
sendServerMessage("Unable to add statements containing '>' or '<'.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user