summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 05e71fe19..663ef51ea 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -7570,12 +7570,13 @@ static bool clif_process_message(struct map_session_data* sd, int format, char**
ShowWarning("clif_process_message: Player '%s' sent an unterminated message string!\n", sd->status.name);
return false;
}
- if( messagelen > CHAT_SIZE_MAX )
+ if( messagelen > CHAT_SIZE_MAX-1 )
{ // messages mustn't be too long
- // Normally you can only enter CHATBOX_SIZE-1 chars into the chat box, but Frost Joke / Dazzler's text can be longer.
- // Neither the official client nor server place any restriction on the length of the text in the packet,
- // but we'll only allow reasonably long strings here. This also makes sure all strings fit into the `chatlog` table.
- ShowWarning("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n", sd->status.name, CHAT_SIZE_MAX, message);
+ // Normally you can only enter CHATBOX_SIZE-1 letters into the chat box, but Frost Joke / Dazzler's text can be longer.
+ // Also, the physical size of strings that use multibyte encoding can go multiple times over the chatbox capacity.
+ // Neither the official client nor server place any restriction on the length of the data in the packet,
+ // but we'll only allow reasonably long strings here. This also makes sure that they fit into the `chatlog` table.
+ ShowWarning("clif_process_message: Player '%s' sent a message too long ('%.*s')!\n", sd->status.name, CHAT_SIZE_MAX-1, message);
return false;
}