diff options
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 96e458600..cf742fbf6 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5490,23 +5490,24 @@ void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val /// Send message (modified by [Yor]) (ZC_NOTIFY_PLAYERCHAT). /// 008e <packet len>.W <message>.?B -void clif_displaymessage(const int fd, const char* mes) { +void clif_displaymessage(const int fd, const char *mes) +{ nullpo_retv(mes); - if( map->cpsd_active && fd == 0 ) { + if (map->cpsd_active && fd == 0) { ShowInfo("HCP: %s\n",mes); - } else if ( fd > 0 ) { + } else if (fd > 0) { #if PACKETVER == 20141022 /** for some reason game client crashes depending on message pattern (only for this packet) **/ /** so we redirect to ZC_NPC_CHAT **/ clif->messagecolor_self(fd, COLOR_DEFAULT, mes); #else - size_t len; + int len = (int)strnlen(mes, 255); - if ( ( len = strnlen(mes, 255) ) > 0 ) { // don't send a void message (it's not displaying on the client chat). @help can send void line. + if (len > 0) { // don't send a void message (it's not displaying on the client chat). @help can send void line. WFIFOHEAD(fd, 5 + len); WFIFOW(fd,0) = 0x8e; - WFIFOW(fd,2) = 5 + len; // 4 + len + NULL terminate + WFIFOW(fd,2) = 5 + len; // 4 + len + NUL terminate safestrncpy(WFIFOP(fd,4), mes, len + 1); WFIFOSET(fd, 5 + len); } |