Issue Information
-
#004565
-
5 - Critical
-
Fixed
Issue Confirmations
-
Yes (0)No (0)
Originally posted by Ai4rei
http://www.eathena.w...er&showbug=4565
Currently there is an issue in script command getusers, causing the map-server to crash, when the command is called with parameter 0 and without attached player.
map_id2bl return value is not checked, whether it is NULL or not, and causes access violation on bl->m then.
http://www.eathena.w...er&showbug=4565
Currently there is an issue in script command getusers, causing the map-server to crash, when the command is called with parameter 0 and without attached player.
CODE
BUILDIN_FUNC(getusers)
{
int flag=script_getnum(st,2);
struct block_list *bl=map_id2bl((flag&0x08)?st->oid:st->rid);
int val=0;
switch(flag&0x07){
case 0: val=map[bl->m].users; break; // bl==NULL
case 1: val=map_getusers(); break;
}
script_pushint(st,val);
return 0;
}
{
int flag=script_getnum(st,2);
struct block_list *bl=map_id2bl((flag&0x08)?st->oid:st->rid);
int val=0;
switch(flag&0x07){
case 0: val=map[bl->m].users; break; // bl==NULL
case 1: val=map_getusers(); break;
}
script_pushint(st,val);
return 0;
}
map_id2bl return value is not checked, whether it is NULL or not, and causes access violation on bl->m then.
CODE
prontera,150,150,0 script TestNPC 123,{
detachrid;
getusers 0;
end;
}
detachrid;
getusers 0;
end;
}