mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 21:40:05 +00:00
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:
parent
2f44243abb
commit
f8a359dfe9
@ -873,11 +873,14 @@ void ChatManager::announcementHandler(CNSocket* sock, CNPacketData* data) {
|
|||||||
// we only allow plain ascii, at least for now
|
// we only allow plain ascii, at least for now
|
||||||
std::string ChatManager::sanitizeText(std::string text, bool allowNewlines) {
|
std::string ChatManager::sanitizeText(std::string text, bool allowNewlines) {
|
||||||
int i;
|
int i;
|
||||||
char buf[128];
|
const int BUFSIZE = 512;
|
||||||
|
char buf[BUFSIZE];
|
||||||
|
|
||||||
|
assert(text.size() < BUFSIZE);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for (char c : text) {
|
for (char c : text) {
|
||||||
if (i >= 127)
|
if (i >= BUFSIZE-1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!allowNewlines && c == '\n')
|
if (!allowNewlines && c == '\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user