Skip to content
Snippets Groups Projects
Commit 11c8dd36 authored by Stefano Babic's avatar Stefano Babic Committed by Wolfgang Denk
Browse files

FAT: buffer overflow with FAT12/16


Last commit 3831530d was intended
"explicitly specify FAT12/16 root directory parsing buffer size, instead
of relying on cluster size". Howver, the underlying function requires
the size of the buffer in blocks, not in bytes, and instead of passing
a double sector size a request for 1024 blocks is sent. This generates
a buffer overflow with overwriting of other structure (in the case seen,
USB structures were overwritten).

Signed-off-by: default avatarStefano Babic <sbabic@denx.de>
CC: Mikhail Zolotaryov <lebon@lebon.org.ua>
parent 70994c79
No related branches found
No related tags found
No related merge requests found
...@@ -858,7 +858,7 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize, ...@@ -858,7 +858,7 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
if (disk_read(cursect, if (disk_read(cursect,
(mydata->fatsize == 32) ? (mydata->fatsize == 32) ?
(mydata->clust_size) : (mydata->clust_size) :
LINEAR_PREFETCH_SIZE, LINEAR_PREFETCH_SIZE / SECTOR_SIZE,
do_fat_read_block) < 0) { do_fat_read_block) < 0) {
debug("Error: reading rootdir block\n"); debug("Error: reading rootdir block\n");
return -1; return -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment