diff options
author | Ibrahim Zidan <brahem@aotsw.com> | 2020-04-04 02:48:42 +0200 |
---|---|---|
committer | Ibrahim Zidan <brahem@aotsw.com> | 2020-04-05 20:03:27 +0200 |
commit | 58c4ce73b9fdc1d67a928e37742510bf49bb7dbc (patch) | |
tree | 8d0b1b1d871a634b3f71f0c082bca00061f99884 /src/map/script.c | |
parent | f9f72c9d4a8c46587d06ba7c95c07d889be2c803 (diff) | |
download | hercules-58c4ce73b9fdc1d67a928e37742510bf49bb7dbc.tar.gz hercules-58c4ce73b9fdc1d67a928e37742510bf49bb7dbc.tar.bz2 hercules-58c4ce73b9fdc1d67a928e37742510bf49bb7dbc.tar.xz hercules-58c4ce73b9fdc1d67a928e37742510bf49bb7dbc.zip |
Fixed a memory violation in quest info caused by accessing -1 index when qi_list vector length is 0
Signed-off-by: Ibrahim Zidan <brahem@aotsw.com>
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/map/script.c b/src/map/script.c index b8a7979a7..9a2b0f757 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -22021,12 +22021,13 @@ static BUILDIN(setquestinfo) return false; } - qi = &VECTOR_LAST(nd->qi_data); - if (qi == NULL) { + if (VECTOR_LENGTH(nd->qi_data) == 0) { ShowWarning("buildin_setquestinfo: no valide questinfo data has been found for this npc.\n"); return false; } + qi = &VECTOR_LAST(nd->qi_data); + switch (type) { case QINFO_JOB: { |