From 1bbec92ffb269156c2a3e32b25072eab572502ef Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Thu, 6 Oct 2016 07:47:56 +0200 Subject: Fix out-of-bounds accesses to set_info --- src/object1.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/object1.cc b/src/object1.cc index 7a9f7543..8f1e5905 100644 --- a/src/object1.cc +++ b/src/object1.cc @@ -6058,10 +6058,10 @@ bool_ wield_set(s16b a_idx, s16b set_idx, bool_ silent) auto &set_info = game->edit_data.set_info; auto const &a_info = game->edit_data.a_info; - auto s_ptr = &set_info[set_idx]; - if ( -1 == a_info[a_idx].set) return (FALSE); + auto s_ptr = &set_info[set_idx]; + int i; for (i = 0; i < s_ptr->num; i++) { @@ -6094,10 +6094,10 @@ bool_ takeoff_set(s16b a_idx, s16b set_idx) auto &set_info = game->edit_data.set_info; auto const &a_info = game->edit_data.a_info; - auto s_ptr = &set_info[set_idx]; - if ( -1 == a_info[a_idx].set) return (FALSE); + auto s_ptr = &set_info[set_idx]; + int i; for (i = 0; i < s_ptr->num; i++) { @@ -6130,13 +6130,13 @@ void apply_set(s16b a_idx, s16b set_idx) auto const &set_info = game->edit_data.set_info; auto const &a_info = game->edit_data.a_info; - auto s_ptr = &set_info[set_idx]; - if ( -1 == a_info[a_idx].set) { return; } + auto s_ptr = &set_info[set_idx]; + int i; for (i = 0; i < s_ptr->num; i++) { -- cgit v1.2.3