- skip = Offset / disk->BytesPerCluster;\r
- LOG("skip = %i", skip);\r
- // Skip previous clusters\r
- for(; skip-- ; )\r
- {\r
- if(Cluster) *Cluster = cluster;\r
- cluster = FAT_int_GetFatValue(disk, cluster);\r
- // Check for end of cluster chain\r
- if(cluster == GETFATVALUE_EOC) { LEAVE('i', 1); return 1; }\r
+ Uint32 root_byte_count = disk->bootsect.files_in_root * 32 ;\r
+ if( Offset >= root_byte_count ) {\r
+ LOG("FAT12/16 root out of range (%i >= %i)", Offset, root_byte_count);\r
+ LEAVE('i', 1);\r
+ return 1;\r