- Some corrections in the clif_parse_whisper function which should fix crashes in the chat_log under "certain" conditions.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6423 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
95cee853fa
commit
c24b68e5eb
@ -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.
|
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||||
|
|
||||||
2006/04/30
|
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 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 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
|
* Fixed a logic error that was likely the cause of pet loot drops not
|
||||||
|
@ -8808,7 +8808,7 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 <len>.w <ni
|
|||||||
struct npc_data *npc;
|
struct npc_data *npc;
|
||||||
char split_data[10][50];
|
char split_data[10][50];
|
||||||
int j=0,k=0;
|
int j=0,k=0;
|
||||||
char *whisper_tmp;
|
char target[NAME_LENGTH+1];
|
||||||
char output[256];
|
char output[256];
|
||||||
RFIFOHEAD(fd);
|
RFIFOHEAD(fd);
|
||||||
|
|
||||||
@ -8827,19 +8827,21 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 <len>.w <ni
|
|||||||
(sd->sc.data[SC_BERSERK].timer!=-1 || sd->sc.data[SC_NOCHAT].timer != -1))
|
(sd->sc.data[SC_BERSERK].timer!=-1 || sd->sc.data[SC_NOCHAT].timer != -1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
memcpy(&target,RFIFOP(fd, 4),NAME_LENGTH);
|
||||||
|
target[NAME_LENGTH]='\0';
|
||||||
|
|
||||||
//Chat Logging type 'W' / Whisper
|
//Chat Logging type 'W' / Whisper
|
||||||
if(log_config.chat&1 //we log everything then
|
if(log_config.chat&1 //we log everything then
|
||||||
|| ( log_config.chat&2 //if Whisper bit is on
|
|| ( 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
|
&& ( !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 //
|
// Lordalfa - Paperboy - To whisper NPC commands //
|
||||||
//-------------------------------------------------------//
|
//-------------------------------------------------------//
|
||||||
whisper_tmp = (char*) RFIFOP(fd,4);
|
if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) >4)) {
|
||||||
if (whisper_tmp[0] && (strncasecmp(whisper_tmp,"NPC:",4) == 0) && (strlen(whisper_tmp) >4)) {
|
char *whisper_tmp = target+4; //Skip the NPC: string part.
|
||||||
whisper_tmp += 4; //Skip the NPC: string part.
|
|
||||||
if ((npc = npc_name2id(whisper_tmp)))
|
if ((npc = npc_name2id(whisper_tmp)))
|
||||||
{
|
{
|
||||||
whisper_tmp=(char *)aMallocA((strlen((char *)(RFIFOP(fd,28)))+1)*sizeof(char));
|
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 <len>.w <ni
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Main chat [LuzZza]
|
// Main chat [LuzZza]
|
||||||
if(strcmpi((const char*)RFIFOP(fd,4), main_chat_nick) == 0) {
|
if(strcmpi(target, main_chat_nick) == 0) {
|
||||||
if(!sd->state.mainchat) {
|
if(!sd->state.mainchat) {
|
||||||
clif_displaymessage(fd, msg_txt(388)); // You should enable main chat with "@main on" command.
|
clif_displaymessage(fd, msg_txt(388)); // You should enable main chat with "@main on" command.
|
||||||
return;
|
return;
|
||||||
@ -8896,16 +8898,16 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 <len>.w <ni
|
|||||||
}
|
}
|
||||||
|
|
||||||
// searching destination character
|
// searching destination character
|
||||||
dstsd = map_nick2sd((char*)RFIFOP(fd,4));
|
dstsd = map_nick2sd(target);
|
||||||
// player is not on this map-server
|
// player is not on this map-server
|
||||||
if (dstsd == NULL ||
|
if (dstsd == NULL ||
|
||||||
// At this point, don't send wisp/page if it's not exactly the same name, because (example)
|
// At this point, don't send wisp/page if it's not exactly the same name, because (example)
|
||||||
// if there are 'Test' player on an other map-server and 'test' player on this map-server,
|
// if there are 'Test' player on an other map-server and 'test' player on this map-server,
|
||||||
// and if we ask for 'Test', we must not contact 'test' player
|
// and if we ask for 'Test', we must not contact 'test' player
|
||||||
// so, we send information to inter-server, which is the only one which decide (and copy correct name).
|
// so, we send information to inter-server, which is the only one which decide (and copy correct name).
|
||||||
strcmp(dstsd->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
|
// 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
|
// player is on this map-server
|
||||||
else {
|
else {
|
||||||
// if you send to your self, don't send anything to others
|
// if you send to your self, don't send anything to others
|
||||||
|
Loading…
x
Reference in New Issue
Block a user