Skip to content

Commit

Permalink
Sanitize the input (variable reference) of getitemgroupitems
Browse files Browse the repository at this point in the history
Signed-off-by: Haru <[email protected]>
  • Loading branch information
MishimaHaruna committed Apr 30, 2024
1 parent a5d89dc commit 7cbc70c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/map/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -9212,6 +9212,22 @@ static BUILDIN(getitemgroupitems)
int32 idata = reference_getindex(data);
int32 dataid = reference_getid(data);
const char *data_name = reference_getname(data);

if (not_server_variable(*data_name)) {
if (script->rid2sd(st) == NULL) {
// no player attached
script_pushint(st, 0);
return false;
}
}

if (is_string_variable(data_name)) {
// string array
ShowError("buildin_getitemgroupitems: not an integer array reference\n");
script->reportdata(data);
st->state = END;
return false;
}

int count = 0;
for (int i = 0; i < group.qty; i++) {
Expand Down

0 comments on commit 7cbc70c

Please sign in to comment.