From 6de72085afcf86e1fb159d58cdbd6237c85b37ba Mon Sep 17 00:00:00 2001 From: Salanto Date: Mon, 15 Mar 2021 12:45:39 +0100 Subject: [PATCH 1/2] Prevent empty OOC name --- include/server.h | 1 - src/packets.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/server.h b/include/server.h index 16f045a..cac743e 100644 --- a/include/server.h +++ b/include/server.h @@ -52,7 +52,6 @@ class Server : public QObject { void broadcast(AOPacket packet, int area_index); void broadcast(AOPacket packet); QString getServerName(); - QString getMOTD(); int getDiceValue(QString value_type); int getCharID(QString char_name); diff --git a/src/packets.cpp b/src/packets.cpp index b0cf50d..dabfbba 100644 --- a/src/packets.cpp +++ b/src/packets.cpp @@ -174,7 +174,7 @@ void AOClient::pktOocChat(AreaData* area, int argc, QStringList argv, AOPacket p { ooc_name = dezalgo(argv[0]).replace(QRegExp("\\[|\\]|\\{|\\}|\\#|\\$|\\%|\\&"), ""); // no fucky wucky shit here - if (ooc_name == server->getServerName()) // impersonation prevention + if (ooc_name == server->getServerName() || "") // impersonation & empty name protection return; QString message = dezalgo(argv[1]); From 6415732da3525f97d7d144ce6a32052a09b3e798 Mon Sep 17 00:00:00 2001 From: Salanto Date: Mon, 15 Mar 2021 16:38:37 +0100 Subject: [PATCH 2/2] Logic is hard, mkay? --- src/packets.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/packets.cpp b/src/packets.cpp index dabfbba..3bb681d 100644 --- a/src/packets.cpp +++ b/src/packets.cpp @@ -173,8 +173,7 @@ void AOClient::pktIcChat(AreaData* area, int argc, QStringList argv, AOPacket pa void AOClient::pktOocChat(AreaData* area, int argc, QStringList argv, AOPacket packet) { ooc_name = dezalgo(argv[0]).replace(QRegExp("\\[|\\]|\\{|\\}|\\#|\\$|\\%|\\&"), ""); // no fucky wucky shit here - - if (ooc_name == server->getServerName() || "") // impersonation & empty name protection + if (ooc_name.isEmpty() || ooc_name == server->getServerName()) // impersonation & empty name protection return; QString message = dezalgo(argv[1]);