summaryrefslogtreecommitdiff
path: root/src/object1.cc
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2016-10-06 07:47:56 +0200
committerBardur Arantsson <bardur@scientician.net>2016-10-06 07:47:56 +0200
commit1bbec92ffb269156c2a3e32b25072eab572502ef (patch)
treee809f0aadfe8b55342cbcbf5b7a71dc97250cac8 /src/object1.cc
parentb3d136333c1b516123cc83e3dc96d4bd79dd52ca (diff)
Fix out-of-bounds accesses to set_info
Diffstat (limited to 'src/object1.cc')
-rw-r--r--src/object1.cc12
1 files 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++)
{