summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/fat/fat.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 89f2acbba1e..9ce5df59f9b 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -216,6 +216,11 @@ static __u32 get_fatent(fsdata *mydata, __u32 entry)
if (flush_dirty_fat_buffer(mydata) < 0)
return -1;
+ if (getsize > FATBUFBLOCKS) {
+ debug("getsize is too large for bufptr\n");
+ getsize = FATBUFBLOCKS;
+ }
+
if (disk_read(startblock, getsize, bufptr) < 0) {
debug("Error reading FAT blocks\n");
return ret;