summaryrefslogtreecommitdiff
path: root/src/map/intif.c
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-03-01 12:04:03 -0700
committerJared Adams <jaxad0127@gmail.com>2009-03-01 12:04:03 -0700
commite0a6fcba9439ed72ca36c2f95520eafe8b1dbebb (patch)
tree4f344567b20159103f377bfbfaffc235347b30ad /src/map/intif.c
parent45ab260d4addc77e66516ebf0f9342cdc9460b32 (diff)
downloadtmwa-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
Diffstat (limited to 'src/map/intif.c')
-rw-r--r--src/map/intif.c9
1 files changed, 5 insertions, 4 deletions
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)