mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-13 05:55:02 -04:00
FAT: get_fatent: Fix FAT boundary check
startblock must be taken into account in order not to read past the end of the FAT. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Wolfgang Denk <wd@denx.de>
This commit is contained in:
parent
9795e07b04
commit
8006dd2e57
@ -207,8 +207,8 @@ static __u32 get_fatent(fsdata *mydata, __u32 entry)
|
|||||||
__u32 fatlength = mydata->fatlength;
|
__u32 fatlength = mydata->fatlength;
|
||||||
__u32 startblock = bufnum * FATBUFBLOCKS;
|
__u32 startblock = bufnum * FATBUFBLOCKS;
|
||||||
|
|
||||||
if (getsize > fatlength)
|
if (startblock + getsize > fatlength)
|
||||||
getsize = fatlength;
|
getsize = fatlength - startblock;
|
||||||
|
|
||||||
fatlength *= mydata->sect_size; /* We want it in bytes now */
|
fatlength *= mydata->sect_size; /* We want it in bytes now */
|
||||||
startblock += mydata->fat_sect; /* Offset from start of disk */
|
startblock += mydata->fat_sect; /* Offset from start of disk */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user