From 710664d4dc998aacd6b152ac3dbe32f2acd933b0 Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 1 May 2006 03:31:31 +0000 Subject: - Some corrections in the clif_parse_whisper function which should fix crashes in the chat_log under "certain" conditions. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6423 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 2 ++ src/map/clif.c | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index ca06d4b86..4d0fc8e1f 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/04/30 + * Some corrections in the clif_parse_whisper function which should fix + crashes in the chat_log under "certain" conditions. [Skotlex] * Fixed dangling pointer in pc_steal_item (missing lines) causing crash. [Lance] * Fixed lack of initialization in chrif_authreq causing crashes in chrif_authok. [Lance] * Fixed a logic error that was likely the cause of pet loot drops not diff --git a/src/map/clif.c b/src/map/clif.c index 3c1c33db5..0efd160b4 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8808,7 +8808,7 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 .w .w sc.data[SC_BERSERK].timer!=-1 || sd->sc.data[SC_NOCHAT].timer != -1)) return; + memcpy(&target,RFIFOP(fd, 4),NAME_LENGTH); + target[NAME_LENGTH]='\0'; + //Chat Logging type 'W' / Whisper if(log_config.chat&1 //we log everything then || ( log_config.chat&2 //if Whisper bit is on && ( !agit_flag || !(log_config.chat&16) ))) //if WOE ONLY flag is off or AGIT is OFF - log_chat("W", 0, sd->status.char_id, sd->status.account_id, (char*)mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, (char*)RFIFOP(fd, 4), (char*)RFIFOP(fd, 28)); + log_chat("W", 0, sd->status.char_id, sd->status.account_id, (char*)mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, target, (char*)RFIFOP(fd, 28)); //-------------------------------------------------------// // Lordalfa - Paperboy - To whisper NPC commands // //-------------------------------------------------------// - whisper_tmp = (char*) RFIFOP(fd,4); - if (whisper_tmp[0] && (strncasecmp(whisper_tmp,"NPC:",4) == 0) && (strlen(whisper_tmp) >4)) { - whisper_tmp += 4; //Skip the NPC: string part. + if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) >4)) { + char *whisper_tmp = target+4; //Skip the NPC: string part. if ((npc = npc_name2id(whisper_tmp))) { whisper_tmp=(char *)aMallocA((strlen((char *)(RFIFOP(fd,28)))+1)*sizeof(char)); @@ -8881,7 +8883,7 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 .w state.mainchat) { clif_displaymessage(fd, msg_txt(388)); // You should enable main chat with "@main on" command. return; @@ -8896,16 +8898,16 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 .w status.name, (const char*)RFIFOP(fd,4)) != 0) // not exactly same name + strcmp(dstsd->status.name, target) != 0) // not exactly same name // send message to inter-server - intif_wis_message(sd, (char*)RFIFOP(fd,4), (char*)RFIFOP(fd,28), RFIFOW(fd,2)-28); + intif_wis_message(sd, target, (char*)RFIFOP(fd,28), RFIFOW(fd,2)-28); // player is on this map-server else { // if you send to your self, don't send anything to others -- cgit v1.2.3-70-g09d2