diff options
author | Ibrahim Zidan <brahem@aotsw.com> | 2020-04-04 01:44:39 +0200 |
---|---|---|
committer | Ibrahim Zidan <brahem@aotsw.com> | 2020-04-05 20:03:12 +0200 |
commit | f9f72c9d4a8c46587d06ba7c95c07d889be2c803 (patch) | |
tree | cd704547c32bf1ec901d948227397486e48ad357 /src/map/map.c | |
parent | dd7f653b00239299cdecb7ca826c21e5957863da (diff) | |
download | hercules-f9f72c9d4a8c46587d06ba7c95c07d889be2c803.tar.gz hercules-f9f72c9d4a8c46587d06ba7c95c07d889be2c803.tar.bz2 hercules-f9f72c9d4a8c46587d06ba7c95c07d889be2c803.tar.xz hercules-f9f72c9d4a8c46587d06ba7c95c07d889be2c803.zip |
Fix quest info copying npc_data instead of storing it pointer, resulting in always false comparison and even possible memory violation access
Signed-off-by: Ibrahim Zidan <brahem@aotsw.com>
Diffstat (limited to 'src/map/map.c')
-rw-r--r-- | src/map/map.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/map/map.c b/src/map/map.c index defa56b2e..6ebc50ba3 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -6047,11 +6047,11 @@ static bool map_add_questinfo(int m, struct npc_data *nd) nullpo_retr(false, nd); Assert_retr(false, m >= 0 && m < map->count); - if (&VECTOR_LAST(map->list[m].qi_list) == nd) + if (VECTOR_LAST(map->list[m].qi_list) == nd) return false; VECTOR_ENSURE(map->list[m].qi_list, 1, 1); - VECTOR_PUSH(map->list[m].qi_list, *nd); + VECTOR_PUSH(map->list[m].qi_list, nd); return true; } @@ -6062,7 +6062,7 @@ static bool map_remove_questinfo(int m, struct npc_data *nd) Assert_retr(false, m >= 0 && m < map->count); int i; - ARR_FIND(0, VECTOR_LENGTH(map->list[m].qi_list), i, &VECTOR_INDEX(map->list[m].qi_list, i) == nd); + ARR_FIND(0, VECTOR_LENGTH(map->list[m].qi_list), i, VECTOR_INDEX(map->list[m].qi_list, i) == nd); if (i != VECTOR_LENGTH(map->list[m].qi_list)) { VECTOR_ERASE(map->list[m].qi_list, i); return true; |