From fd7f5e8feda49fd7724e96e366f8770f6f7cfe66 Mon Sep 17 00:00:00 2001 From: Dennis Friis Date: Thu, 10 Apr 2008 15:59:04 +0000 Subject: fix mapif_parse_WisToGM not working at all due to mismatch message sizes. --- src/map/intif.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/map/intif.c b/src/map/intif.c index ace0187..4464dc5 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -584,22 +584,20 @@ int mapif_parse_WisToGM(int fd) { // 0x3003/0x3803 .w .24B int i, min_gm_level; struct map_session_data *pl_sd; char Wisp_name[24]; - char mbuf[255]; - char *message = ((RFIFOW(fd,2) - 30) >= sizeof(mbuf)) ? (char *) malloc((RFIFOW(fd,2) - 30)) : mbuf; + char *message = malloc((RFIFOW(fd,2) - 30)); 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), (RFIFOW(fd,2) - 30)); + message[RFIFOW(fd,2) - 31] = '\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) if (pc_isGM(pl_sd) >= min_gm_level) clif_wis_message(i, Wisp_name, message, strlen(message) + 1); - if (message != mbuf) - free(message); + free(message); return 0; } -- cgit v1.2.3-70-g09d2