1.1 --- a/libipc/lib/src/message.c Mon Dec 11 17:26:53 2023 +0100
1.2 +++ b/libipc/lib/src/message.c Mon Dec 11 19:17:25 2023 +0100
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * Interprocess communication message abstraction.
1.6 *
1.7 - * Copyright (C) 2018, 2019, 2021, 2022 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2018, 2019, 2021, 2022, 2023 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -444,8 +444,16 @@
1.13
1.14 void ipc_message_export_capability(ipc_message_t *msg, int item, l4_cap_idx_t ref)
1.15 {
1.16 - msg->mregs.mr[msg->words + item * 2] = 0 | L4_ITEM_MAP;
1.17 - msg->mregs.mr[msg->words + item * 2 + 1] = l4_obj_fpage(ref, 0, L4_FPAGE_RWX).raw;
1.18 + if (l4_is_valid_cap(ref))
1.19 + {
1.20 + msg->mregs.mr[msg->words + item * 2] = 0 | L4_ITEM_MAP;
1.21 + msg->mregs.mr[msg->words + item * 2 + 1] = l4_obj_fpage(ref, 0, L4_FPAGE_RWX).raw;
1.22 + }
1.23 + else
1.24 + {
1.25 + msg->mregs.mr[msg->words + item * 2] = 0;
1.26 + msg->mregs.mr[msg->words + item * 2 + 1] = 0;
1.27 + }
1.28 }
1.29
1.30 /* Export a flexpage at the given position in the message. Here, the snd_base