Skip to content

Commit aea9b95

Browse files
committed
skip checking any ec update image that reports a length beyond our slice bounds
1 parent 39db006 commit aea9b95

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/status/src/ecup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ pub(crate) fn ecupdate_thread(sid: xous::SID) {
202202
// the semver *could* be bogus at this point, but we'll validate the package (which contains the semver) before we use it.
203203
// however, this check is much less computationally expensive than the package validation.
204204
let length = u32::from_le_bytes(package[0x28..0x2c].try_into().unwrap());
205-
if length == 0xffff_ffff { // nothing was staged at all
205+
if length > xous::EC_FW_PKG_LEN { // nothing was staged, or it is bogus (blank FLASH is 0xFFFF_FFFF "length")
206206
xous::return_scalar(msg.sender, UpdateResult::PackageInvalid.to_usize().unwrap()).unwrap();
207207
continue;
208208
}

0 commit comments

Comments
 (0)