From 90de9174210664e1c5af4db59868709d25226545 Mon Sep 17 00:00:00 2001 From: AnnieRuru Date: Tue, 19 Jun 2018 07:51:56 +0800 Subject: Fix SCRIPT_MAX_ARRAYSIZE --- src/map/script.c | 4 ++-- src/map/script.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/map') diff --git a/src/map/script.c b/src/map/script.c index 410a707f1..f5b522ffb 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -4884,7 +4884,7 @@ void script_cleararray_pc(struct map_session_data* sd, const char* varname, void void script_setarray_pc(struct map_session_data* sd, const char* varname, uint32 idx, void* value, int* refcache) { int key; - if( idx >= SCRIPT_MAX_ARRAYSIZE ) { + if (idx > SCRIPT_MAX_ARRAYSIZE) { ShowError("script_setarray_pc: Variable '%s' has invalid index '%u' (char_id=%d).\n", varname, idx, sd->status.char_id); return; } @@ -7484,7 +7484,7 @@ BUILDIN(getelementofarray) id = reference_getid(data); i = script_getnum(st, 3); - if (i < 0 || i >= SCRIPT_MAX_ARRAYSIZE) { + if (i < 0 || i > SCRIPT_MAX_ARRAYSIZE) { ShowWarning("script:getelementofarray: index out of range (%"PRId64")\n", i); script->reportdata(data); script_pushnil(st); diff --git a/src/map/script.h b/src/map/script.h index a0cfb7692..03342c4e8 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -50,7 +50,7 @@ struct item_data; #define NUM_WHISPER_VAR 10 /// Maximum amount of elements in script arrays -#define SCRIPT_MAX_ARRAYSIZE (UINT_MAX - 1) +#define SCRIPT_MAX_ARRAYSIZE (INT_MAX - 1) #define SCRIPT_BLOCK_SIZE 512 -- cgit v1.2.3-70-g09d2