diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/chrif.c | 10 | ||||
-rw-r--r-- | src/map/clif.c | 26 | ||||
-rw-r--r-- | src/map/irc.c | 1 |
3 files changed, 22 insertions, 15 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c index 7039a8d71..e08ee8cdf 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -319,9 +319,11 @@ int chrif_removemap(int fd){ }
int chrif_save_ack(int fd) {
- int aid = RFIFOL(fd,2), cid = RFIFOL(fd,6);
- struct map_session_data *sd = map_id2sd(aid);
- if (sd && sd->status.char_id == cid)
+ struct map_session_data *sd;
+ RFIFOHEAD(fd);
+ sd = map_id2sd(RFIFOL(fd,2));
+
+ if (sd && sd->status.char_id == RFIFOL(fd,6))
map_quit_ack(sd);
return 0;
}
@@ -1410,7 +1412,7 @@ int chrif_disconnect(int fd) { void chrif_update_ip(int fd){
unsigned long new_ip;
-
+ WFIFOHEAD(fd, 6);
new_ip = resolve_hostbyname(char_ip_str, NULL, NULL);
if (new_ip && new_ip != char_ip)
char_ip = new_ip; //Update char_ip
diff --git a/src/map/clif.c b/src/map/clif.c index c221f5e8c..3b2f02634 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1541,7 +1541,7 @@ int clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) void clif_send_homdata(struct map_session_data *sd, int type, int param) { //[orn]
int fd;
-
+ WFIFOHEAD(fd, packet_len_table[0x230]);
nullpo_retv(sd);
nullpo_retv(sd->hd);
@@ -1559,7 +1559,7 @@ int clif_homskillinfoblock(struct map_session_data *sd) { //[orn] struct homun_data *hd;
int fd;
int i,j,len=4,id;
-
+ WFIFOHEAD(fd, 4+37*MAX_HOMUNSKILL);
nullpo_retr(0, sd);
hd = sd->hd;
@@ -1591,7 +1591,7 @@ int clif_homskillinfoblock(struct map_session_data *sd) { //[orn] void clif_homskillup(struct map_session_data *sd, int skill_num) { //[orn]
struct homun_data *hd;
int fd,skillid;
-
+ WFIFOHEAD(sd->fd, packet_len_table[0x239]);
nullpo_retv(sd);
skillid = skill_num - HM_SKILLBASE - 1;
@@ -1611,12 +1611,12 @@ void clif_homskillup(struct map_session_data *sd, int skill_num) { //[orn] void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) { //[orn]
struct homun_data *hd;
+ RFIFOHEAD(fd);
nullpo_retv(sd);
if((hd=sd->hd) == NULL)
return;
- RFIFOHEAD(fd);
memcpy(hd->homunculus.name,RFIFOP(fd,2),24);
hd->homunculus.rename_flag = 1;
clif_hominfo(sd,hd,0);
@@ -1637,7 +1637,7 @@ void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) { //[orn] void clif_parse_HomMoveTo(int fd,struct map_session_data *sd) { //[orn]
int x,y,cmd;
-
+ RFIFOHEAD(fd);
nullpo_retv(sd);
if(!merc_is_hom_active(sd->hd))
@@ -1657,7 +1657,7 @@ void clif_parse_HomMoveTo(int fd,struct map_session_data *sd) { //[orn] void clif_parse_HomAttack(int fd,struct map_session_data *sd) { //[orn]
struct block_list *target;
-
+ RFIFOHEAD(fd);
nullpo_retv(sd);
if(!merc_is_hom_active(sd->hd))
@@ -1686,11 +1686,11 @@ void clif_parse_HomMenu(int fd, struct map_session_data *sd) { //[orn] int clif_hom_food(struct map_session_data *sd,int foodid,int fail) //[orn]
{
int fd;
+ WFIFOHEAD(sd->fd,packet_len_table[0x22f]);
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd,packet_len_table[0x22f]);
WFIFOW(fd,0)=0x22f;
WFIFOB(fd,2)=fail;
WFIFOW(fd,3)=foodid;
@@ -1706,11 +1706,11 @@ int clif_hom_food(struct map_session_data *sd,int foodid,int fail) //[orn] int clif_walkok(struct map_session_data *sd)
{
int fd;
+ WFIFOHEAD(sd->fd, packet_len_table[0x87]);
nullpo_retr(0, sd);
fd=sd->fd;
- WFIFOHEAD(fd, packet_len_table[0x87]);
WFIFOW(fd,0)=0x87;
WFIFOL(fd,2)=gettick();
WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y);
@@ -2088,7 +2088,7 @@ int clif_scriptclose(struct map_session_data *sd, int npcid) { */
void clif_sendfakenpc(struct map_session_data *sd, int npcid) {
int fd = sd->fd;
- //sd->npc_id = npcid;
+ WFIFOHEAD(fd, packet_len_table[0x78]);
sd->state.using_fake_npc = 1;
malloc_set(WFIFOP(fd,0), 0, packet_len_table[0x78]);
WFIFOW(fd,0)=0x78;
@@ -9026,6 +9026,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, *------------------------------------------
*/
void clif_parse_ActionRequest(int fd, struct map_session_data *sd) {
+ RFIFOHEAD(fd);
clif_parse_ActionRequest_sub(sd,
RFIFOB(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]),
RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]),
@@ -10158,8 +10159,12 @@ void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) */
void clif_parse_NpcStringInput(int fd,struct map_session_data *sd)
{
- unsigned short message_len = RFIFOW(fd,2)-7;
+ short message_len;
RFIFOHEAD(fd);
+ message_len = RFIFOW(fd,2)-7;
+
+ if(message_len < 1)
+ return; //Blank message?
if(message_len >= sizeof(sd->npc_str)){
ShowWarning("clif: input string too long !\n");
@@ -10169,7 +10174,6 @@ void clif_parse_NpcStringInput(int fd,struct map_session_data *sd) // Exploit prevention if crafted packets (without null) is being sent. [Lance]
memcpy(sd->npc_str,RFIFOP(fd,8),message_len);
sd->npc_str[message_len-1]=0;
-
npc_scriptcont(sd,RFIFOL(fd,4));
}
diff --git a/src/map/irc.c b/src/map/irc.c index 498467ae7..4b9187107 100644 --- a/src/map/irc.c +++ b/src/map/irc.c @@ -144,6 +144,7 @@ int irc_parse(int fd) }
if(RFIFOREST(fd) > 0){
char *incoming_string=aMalloc(RFIFOREST(fd)*sizeof(char));
+ RFIFOHEAD(fd);
memcpy(incoming_string,RFIFOP(fd,0),RFIFOREST(fd));
send_to_parser(fd,incoming_string,"\n");
RFIFOSKIP(fd,RFIFOREST(fd));
|