diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-05-27 21:49:52 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-05-27 21:49:52 +0800 |
| commit | d96ac911c927ec032f91fde2bed3de26c2353b1c (patch) | |
| tree | 083679496935352230a22c775166e4196eec67b9 /src/session.cpp | |
| parent | 2f522573eea46c72f7e77be60ba9702725dca2fa (diff) | |
fix: don't accept ascii seq(0x1B)
this can mess up terminals of others
won't really affect the server as we using ftxui
and it seems to not affect the output somehow
Diffstat (limited to 'src/session.cpp')
| -rw-r--r-- | src/session.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/session.cpp b/src/session.cpp index 2faab20..be1e3cd 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -1,9 +1,9 @@ -#include "session.hpp" #include "chatManager.hpp" #include "commandHandler.hpp" #include "format.hpp" #include "log.hpp" #include "server.hpp" +#include "session.hpp" #include "sessionManager.hpp" #include <algorithm> #include <arpa/inet.h> @@ -101,6 +101,8 @@ void CSession::SRecvData::sanitize() { if (!data.empty() && data.back() == '\n') data.pop_back(); + data.erase(std::remove(data.begin(), data.end(), asciiEscape), data.end()); // don't accept ASCII code, might mess up terminal + if (const auto start = data.find_first_not_of(" \t\r\n"); start != std::string::npos) { const auto end = data.find_last_not_of(" \t\r\n"); data = data.substr(start, end - start + 1); |
