Skip to content

Commit

Permalink
Fix out-of-bounds access in NodeDefManager::nodeboxConnects
Browse files Browse the repository at this point in the history
  • Loading branch information
Desour authored and sfan5 committed Oct 30, 2023
1 parent 1d31533 commit ec7a1f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/nodedef.cpp
Expand Up @@ -1773,8 +1773,9 @@ bool NodeDefManager::nodeboxConnects(MapNode from, MapNode to,
};
if (f2.param_type_2 == CPT2_FACEDIR ||
f2.param_type_2 == CPT2_COLORED_FACEDIR) {
// FIXME: support arbitrary rotations (to.param2 & 0x1F) (#7696)
return (f2.connect_sides
& rot[(connect_face * 4) + (to.param2 & 0x1F)]);
& rot[(connect_face * 4) + (to.param2 & 0x03)]);
} else if (f2.param_type_2 == CPT2_4DIR ||
f2.param_type_2 == CPT2_COLORED_4DIR) {
return (f2.connect_sides
Expand Down

0 comments on commit ec7a1f0

Please sign in to comment.