From fd34be15ebf91c4dc2bb38aef80a2a20af3b2e7a Mon Sep 17 00:00:00 2001 From: chenxiaoyi Date: Fri, 11 Aug 2023 16:26:01 +0800 Subject: [PATCH] sim: use correct size to avoid buffer overflow Fix buffer overflow issue from PR #10128, since the sizeof xcpt_reg_t is different on 32/64 bit platform. Signed-off-by: chenxiaoyi --- arch/sim/src/sim/sim_initialstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sim/src/sim/sim_initialstate.c b/arch/sim/src/sim/sim_initialstate.c index 76d967d28f..1a5a084568 100644 --- a/arch/sim/src/sim/sim_initialstate.c +++ b/arch/sim/src/sim/sim_initialstate.c @@ -113,7 +113,7 @@ void up_initial_state(struct tcb_s *tcb) /* Mask the interrupt until switching to the new task */ - memset(&tcb->xcp.regs[JB_FLAG], 0xff, sizeof(xcpt_reg_t) * 2); + memset(&tcb->xcp.regs[JB_FLAG], 0xff, sizeof(uint32_t) * 2); tcb->xcp.regs[JB_PC] = (xcpt_reg_t)pre_start;