We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2dbce5c commit 5d90bf4Copy full SHA for 5d90bf4
source/board/microbitv2/microbitv2.c
@@ -582,7 +582,10 @@ void vfs_user_build_filesystem_hook() {
582
// File callback to be used with vfs_add_file to return file contents
583
static uint32_t read_file_data_txt(uint32_t sector_offset, uint8_t *data, uint32_t num_sectors)
584
{
585
- memcpy(data, (uint8_t *) (FLASH_STORAGE_ADDRESS + VFS_SECTOR_SIZE * sector_offset), VFS_SECTOR_SIZE);
+ // Ignore out of bound reads
586
+ if ( (FLASH_STORAGE_ADDRESS + VFS_SECTOR_SIZE * sector_offset) < (FLASH_CONFIG_ADDRESS + FLASH_INTERFACE_SIZE) ) {
587
+ memcpy(data, (uint8_t *) (FLASH_STORAGE_ADDRESS + VFS_SECTOR_SIZE * sector_offset), VFS_SECTOR_SIZE);
588
+ }
589
590
return VFS_SECTOR_SIZE;
591
}
0 commit comments