summaryrefslogtreecommitdiff
path: root/Source/Kernel/FileSystems/FAT/FATFS.class.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Kernel/FileSystems/FAT/FATFS.class.cpp')
-rw-r--r--Source/Kernel/FileSystems/FAT/FATFS.class.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/Kernel/FileSystems/FAT/FATFS.class.cpp b/Source/Kernel/FileSystems/FAT/FATFS.class.cpp
index 67b4013..4c662de 100644
--- a/Source/Kernel/FileSystems/FAT/FATFS.class.cpp
+++ b/Source/Kernel/FileSystems/FAT/FATFS.class.cpp
@@ -136,8 +136,8 @@ u32int FATFS::read(FileNode* file, u64int position, u32int max_length, u8int *da
//Read first cluster
u8int* temp = (u8int*)Mem::alloc(m_clusterSize);
readCluster(clust, temp);
- memcpy(data, temp + clusterOffset, (m_clusterSize - clusterOffset));
- //Read next clusters
+ memcpy(data, temp + clusterOffset, (len > m_clusterSize - clusterOffset ? m_clusterSize - clusterOffset : len));
+ //Read next cluster
u32int pos = (m_clusterSize - clusterOffset);
for (u32int i = 1; i < clusters; i++) {
clust = nextCluster(clust);