From e0a6fcba9439ed72ca36c2f95520eafe8b1dbebb Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sun, 1 Mar 2009 12:04:03 -0700 Subject: Fix bug in the whisper to all GMs code Also remove a redundant space --- src/map/clif.c | 4 ++-- src/map/intif.c | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index 8fe1ae6..41b2d86 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7527,9 +7527,9 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c < intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, message, strlen(message) + 1); if (battle_config.spam_ban > 0) - sprintf(message, " This player has been banned for %d hours(s).", battle_config.spam_ban); + sprintf(message, "This player has been banned for %d hours(s).", battle_config.spam_ban); else - sprintf(message, " This player hasn't been banned (Ban option is disabled)."); + sprintf(message, "This player hasn't been banned (Ban option is disabled)."); printf("%s\n", message); intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, message, strlen(message) + 1); diff --git a/src/map/intif.c b/src/map/intif.c index 3790d3b..a973121 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -581,7 +581,7 @@ int intif_parse_WisEnd(int fd) { // Received wisp message from map-server via char-server for ALL gm int mapif_parse_WisToGM(int fd) { // 0x3003/0x3803 .w .24B .w .?B - int i, min_gm_level; + int i, min_gm_level, len; struct map_session_data *pl_sd; char Wisp_name[24]; char mbuf[255]; @@ -589,13 +589,14 @@ int mapif_parse_WisToGM(int fd) { // 0x3003/0x3803 .w .24B if (RFIFOW(fd,2)-30 <= 0) return 0; - char *message = ((RFIFOW(fd,2) - 30) >= 255) ? (char *) malloc((RFIFOW(fd,2) - 30)) : mbuf; + len = RFIFOW(fd,2) - 30; + char *message = ((len) >= 255) ? (char *) malloc(len) : mbuf; min_gm_level = (int)RFIFOW(fd,28); memcpy(Wisp_name, RFIFOP(fd,4), 24); Wisp_name[23] = '\0'; - memcpy(message, RFIFOP(fd,30), RFIFOW(fd,2) - 30); - message[sizeof(message) - 1] = '\0'; + memcpy(message, RFIFOP(fd,30), len); + message[len - 1] = '\0'; // information is sended to all online GM for (i = 0; i < fd_max; i++) if (session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth) -- cgit v1.2.3-70-g09d2