diff options
-rw-r--r-- | src/map/script.c | 4 | ||||
-rw-r--r-- | src/map/script.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/map/script.c b/src/map/script.c index 1e635b622..24d03bbe2 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -4929,7 +4929,7 @@ static void script_setarray_pc(struct map_session_data *sd, const char *varname, { 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; } @@ -7540,7 +7540,7 @@ static 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 fe8bcf00b..9a8425ed2 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 |