summaryrefslogtreecommitdiff
path: root/ipc
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-10-01 03:20:31 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-10-01 04:27:00 +0200
commitdd8dc288f5f2395307a766130c37be2c473dfa18 (patch)
treec3a1b8d26bcd5d27038b0438fc462e2310c5f45d /ipc
parente8b1030e140bf0590b4acd4d6dcb84afc7af6403 (diff)
mach_port_names: Make sure we did not overflow the allocated area
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mach_port.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ipc/mach_port.c b/ipc/mach_port.c
index db6dae61..a07b4fe9 100644
--- a/ipc/mach_port.c
+++ b/ipc/mach_port.c
@@ -160,6 +160,7 @@ mach_port_names(
vm_offset_t addr2; /* allocated memory, for types */
vm_map_copy_t memory1; /* copied-in memory, for names */
vm_map_copy_t memory2; /* copied-in memory, for types */
+ ipc_entry_num_t bound;
/* safe simplifying assumption */
assert_static(sizeof(mach_port_name_t) == sizeof(mach_port_type_t));
@@ -170,7 +171,6 @@ mach_port_names(
size = 0;
for (;;) {
- ipc_entry_num_t bound;
vm_size_t size_needed;
is_read_lock(space);
@@ -240,6 +240,7 @@ mach_port_names(
names, types, &actual);
}
}
+ assert(actual < bound);
is_read_unlock(space);
if (actual == 0) {