fix msc example with out of bound lba (due to compliant test)
This commit is contained in:
		| @@ -178,6 +178,9 @@ int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buff | ||||
| { | ||||
|   (void) lun; | ||||
|  | ||||
|   // out of ramdisk | ||||
|   if ( lba >= DISK_BLOCK_NUM ) return -1; | ||||
|  | ||||
|   uint8_t const* addr = msc_disk[lba] + offset; | ||||
|   memcpy(buffer, addr, bufsize); | ||||
|  | ||||
| @@ -190,6 +193,9 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t* | ||||
| { | ||||
|   (void) lun; | ||||
|  | ||||
|   // out of ramdisk | ||||
|   if ( lba >= DISK_BLOCK_NUM ) return -1; | ||||
|  | ||||
| #ifndef CFG_EXAMPLE_MSC_READONLY | ||||
|   uint8_t* addr = msc_disk[lba] + offset; | ||||
|   memcpy(addr, buffer, bufsize); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 hathach
					hathach