mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-30 16:14:13 +00:00
base-foc: explicit array-index bounds check
Adding an explicit check clarifies at the first glance that the array bounds are respected without needing knowledge about MAX_CAPS_PER_MSG and L4_UTCB_GENERIC_DATA_SIZE (used for dimensioning 'mr').
This commit is contained in:
parent
9ec66f0594
commit
01713c74f9
@ -238,6 +238,11 @@ static l4_msgtag_t copy_msgbuf_to_utcb(Msgbuf_base &snd_msg,
|
||||
/* setup flexpage for valid capability to delegate */
|
||||
if (caps[i].valid) {
|
||||
unsigned const idx = num_msg_words + 2*num_cap_sel;
|
||||
|
||||
/* check bounds of 'l4_msg_regs_t::mr' */
|
||||
if (idx + 1 >= L4_UTCB_GENERIC_DATA_SIZE)
|
||||
break;
|
||||
|
||||
l4_utcb_mr()->mr[idx] = L4_ITEM_MAP/* | L4_ITEM_CONT*/;
|
||||
l4_utcb_mr()->mr[idx + 1] = l4_obj_fpage(caps[i].sel,
|
||||
0, L4_FPAGE_RWX).raw;
|
||||
|
Loading…
x
Reference in New Issue
Block a user