From 890352a3a0e73932fa95e5288d0657b588d7075e Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Wed, 8 Jul 2015 09:46:33 +0700 Subject: [PATCH] Bug Fixes: * Fixed #492, thank @julia40124009 * Fixed #494, thank @Canoe Signed-off-by: Cydh Ramdh --- src/map/clif.c | 4 ++-- src/map/mob.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/map/clif.c b/src/map/clif.c index 74910d326f..0738632cb9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5764,7 +5764,7 @@ void clif_displaymessage(const int fd, const char* mes) /** so we redirect to ZC_NPC_CHAT **/ //clif_colormes(fd, color_table[COLOR_DEFAULT], mes); unsigned long color = (color_table[COLOR_DEFAULT] & 0x0000FF) << 16 | (color_table[COLOR_DEFAULT] & 0x00FF00) | (color_table[COLOR_DEFAULT] & 0xFF0000) >> 16; // RGB to BGR - unsigned short len = strnlen(mes, 255); + unsigned short len = strnlen(mes, CHAT_SIZE_MAX); if (len > 0) { WFIFOHEAD(fd, 13 + len); @@ -5772,7 +5772,7 @@ void clif_displaymessage(const int fd, const char* mes) WFIFOW(fd, 2) = 13 + len; WFIFOL(fd, 4) = 0; WFIFOL(fd, 8) = color; - safestrncpy((char*)WFIFOP(fd, 12), mes, len); + safestrncpy((char*)WFIFOP(fd, 12), mes, len+1); WFIFOSET(fd, WFIFOW(fd, 2)); } #else diff --git a/src/map/mob.c b/src/map/mob.c index 70e3da1294..86aaf60650 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2877,7 +2877,7 @@ int mob_class_change (struct mob_data *md, int mob_id) hp_rate = get_percentage(md->status.hp, md->status.max_hp); md->mob_id = mob_id; - md->db = mobdb; + md->db = mob_db(mob_id); if (battle_config.override_mob_names==1) memcpy(md->name,md->db->name,NAME_LENGTH); else