mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
diskcache: Size the buffers for MAX_LOG_SECTOR_SIZE
Because if we get a logical sector size > min sector size we'll trigger buffer overflows. Change-Id: Ibd24f91a0f8601fbd8c5a5dfeef4ebe5c081f664
This commit is contained in:
parent
e29ddfb6be
commit
f58fad943e
2 changed files with 13 additions and 10 deletions
|
|
@ -173,7 +173,7 @@ bool disk_init(IF_MD_NONVOID(int drive))
|
|||
disk_writer_unlock();
|
||||
|
||||
#ifdef MAX_LOG_SECTOR_SIZE
|
||||
if (info->sector_size > MAX_LOG_SECTOR_SIZE) {
|
||||
if (info->sector_size > MAX_LOG_SECTOR_SIZE || info->sector_size > DC_CACHE_BUFSIZE) {
|
||||
panicf("Unsupported logical sector size: %d",
|
||||
info->sector_size);
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ bool disk_init(IF_MD_NONVOID(int drive))
|
|||
#endif
|
||||
#endif /* CONFIG_STORAGE & STORAGE_ATA */
|
||||
|
||||
memset(sector, 0, LOG_SECTOR_SIZE(drive));
|
||||
memset(sector, 0, DC_CACHE_BUFSIZE);
|
||||
storage_read_sectors(IF_MD(drive,) 0, 1, sector);
|
||||
|
||||
bool init = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue