Skip to content

Commit fd71fcf

Browse files
Flamefirebwbarrett
authored andcommitted
Fix buffer overflow in get_package_rank
The number of local peers does not include the own rank but the own rank is still written to the array which means an out-of-bounds write corrupting the stack. Increase the array size by that missing rank (i.e. +1) Fixes #9018 Signed-off-by: Alexander Grund <Flamefire@users.noreply.github.com> (cherry picked from commit b8b9546) Signed-off-by: Brian Barrett <bbarrett@amazon.com>
1 parent 27dee70 commit fd71fcf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

opal/mca/common/ofi/common_ofi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ static uint32_t get_package_rank(opal_process_info_t *process_info)
305305
int i;
306306
uint16_t relative_locality, *package_rank_ptr;
307307
uint16_t current_package_rank = 0;
308-
uint16_t package_ranks[process_info->num_local_peers];
308+
uint16_t package_ranks[process_info->num_local_peers + 1];
309309
opal_process_name_t pname;
310310
pmix_status_t rc;
311311
char **peers = NULL;

0 commit comments

Comments
 (0)