diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-03-01 12:04:03 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-03-01 12:04:03 -0700 |
commit | e0a6fcba9439ed72ca36c2f95520eafe8b1dbebb (patch) | |
tree | 4f344567b20159103f377bfbfaffc235347b30ad | |
parent | 45ab260d4addc77e66516ebf0f9342cdc9460b32 (diff) | |
download | tmwa-e0a6fcba9439ed72ca36c2f95520eafe8b1dbebb.tar.gz tmwa-e0a6fcba9439ed72ca36c2f95520eafe8b1dbebb.tar.bz2 tmwa-e0a6fcba9439ed72ca36c2f95520eafe8b1dbebb.tar.xz tmwa-e0a6fcba9439ed72ca36c2f95520eafe8b1dbebb.zip |
Fix bug in the whisper to all GMs code
Also remove a redundant space
-rw-r--r-- | src/map/clif.c | 4 | ||||
-rw-r--r-- | src/map/intif.c | 9 |
2 files changed, 7 insertions, 6 deletions
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 <packet_len>.w <wispname>.24B <min_gm_level>.w <message>.?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 <packet_len>.w <wispname>.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) |