Skip to content

Commit

Permalink
common/hostlist: fix out of bounds array access
Browse files Browse the repository at this point in the history
Problem: Internally within the hostlist data structure, an
array of hostranges is kept.  An out of bounds array access
can occur if the number of hostranges is equal to the length
of the array.

Add check to ensure out of bound array access is not allowed
when iterating hosts.
  • Loading branch information
chu11 committed Aug 23, 2024
1 parent 64a7d37 commit d59b352
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/common/hostlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -2278,6 +2278,11 @@ static void _iterator_advance(hostlist_iterator_t i)
return;
if (++(i->depth) > (i->hr->hi - i->hr->lo)) {
i->depth = 0;
if (i->idx >= (i->hl->size - 1)) {
++i->idx;
i->hr = NULL;
return;
}
i->hr = i->hl->hr[++i->idx];
}
}
Expand Down

0 comments on commit d59b352

Please sign in to comment.