From 7b0d446b02f0c6755b3ea1f48068eb2d934dfab7 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 21 Mar 2023 10:29:01 +0100 Subject: [PATCH] Add payload size checks for affinity events --- src/emu/ovni/event.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/emu/ovni/event.c b/src/emu/ovni/event.c index f1ee68f..b8df1ea 100644 --- a/src/emu/ovni/event.c +++ b/src/emu/ovni/event.c @@ -219,6 +219,11 @@ pre_affinity_set(struct emu *emu) return -1; } + if (emu->ev->payload_size != 4) { + err("unexpected payload size %d", emu->ev->payload_size); + return -1; + } + /* Migrate current cpu to the one at index */ int index = emu->ev->payload->i32[0]; struct cpu *newcpu = loom_get_cpu(emu->loom, index); @@ -250,6 +255,11 @@ pre_affinity_set(struct emu *emu) static int pre_affinity_remote(struct emu *emu) { + if (emu->ev->payload_size != 8) { + err("unexpected payload size %d", emu->ev->payload_size); + return -1; + } + int32_t index = emu->ev->payload->i32[0]; int32_t tid = emu->ev->payload->i32[1];