Do not truncate emails to 127 characters

And assert that we never supply a string long enough for
sanitizeText() to truncate.
This commit is contained in:
dongresource 2020-12-19 05:46:38 +01:00
parent 2f44243abb
commit f8a359dfe9

View File

@ -873,11 +873,14 @@ void ChatManager::announcementHandler(CNSocket* sock, CNPacketData* data) {
// we only allow plain ascii, at least for now
std::string ChatManager::sanitizeText(std::string text, bool allowNewlines) {
int i;
char buf[128];
const int BUFSIZE = 512;
char buf[BUFSIZE];
assert(text.size() < BUFSIZE);
i = 0;
for (char c : text) {
if (i >= 127)
if (i >= BUFSIZE-1)
break;
if (!allowNewlines && c == '\n')