usb: mass_storage: check LBA range
Check if LBA is in range of the memory size. Signed-off-by: Johann Fischer <j.fischer@phytec.de>
This commit is contained in:
parent
c88155fd2d
commit
23ace0e556
1 changed files with 7 additions and 0 deletions
|
@ -438,6 +438,13 @@ static bool infoTransfer(void)
|
|||
(cbw.CB[5] << 0);
|
||||
|
||||
LOG_DBG("LBA (block) : 0x%x ", n);
|
||||
if ((n * BLOCK_SIZE) >= memory_size) {
|
||||
LOG_ERR("LBA out of range");
|
||||
csw.Status = CSW_FAILED;
|
||||
sendCSW();
|
||||
return false;
|
||||
}
|
||||
|
||||
addr = n * BLOCK_SIZE;
|
||||
|
||||
/* Number of Blocks to transfer */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue