diff --git a/drv/auxflash-server/src/main.rs b/drv/auxflash-server/src/main.rs index 8a66448c4..6e8a9c9e1 100644 --- a/drv/auxflash-server/src/main.rs +++ b/drv/auxflash-server/src/main.rs @@ -371,6 +371,9 @@ impl idl::InOrderAuxFlashImpl for ServerImpl { offset: u32, data: Leased, ) -> Result<(), RequestError> { + if slot >= SLOT_COUNT { + return Err(AuxFlashError::InvalidSlot.into()); + } if Some(slot) == self.active_slot { return Err(AuxFlashError::SlotActive.into()); } @@ -412,6 +415,9 @@ impl idl::InOrderAuxFlashImpl for ServerImpl { offset: u32, dest: Leased, ) -> Result<(), RequestError> { + if slot >= SLOT_COUNT { + return Err(AuxFlashError::InvalidSlot.into()); + } if offset as usize + dest.len() > SLOT_SIZE { return Err(AuxFlashError::AddressOverflow.into()); }