Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.3:Staging:E
dosfstools
dosfstools-3.0.26-off-by-2.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File dosfstools-3.0.26-off-by-2.patch of Package dosfstools
From 07908124838afcc99c577d1d3e84cef2dbd39cb7 Mon Sep 17 00:00:00 2001 From: Andreas Bombe <aeb@debian.org> Date: Fri, 11 Sep 2015 19:47:29 +0200 Subject: [PATCH] set_fat(): Fix off-by-2 error leading to corruption in FAT12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In FAT12 two 12 bit entries are combined to a 24 bit value (three bytes). Therefore, when an even numbered FAT entry is set in FAT12, it must be be combined with the following entry. To prevent accessing beyond the end of the FAT array, it must be checked that the cluster is not the last one. Previously, the check tested that the requested cluster was equal to fs->clusters - 1. However, fs->clusters is the number of data clusters not including the two reserved FAT entries at the start so the test triggered two clusters early. If the third to last entry was written on a FAT12 filesystem with an odd number of clusters, the second to last entry would be corrupted. This corruption may also lead to invalid memory accesses when the corrupted entry becomes out of bounds and is used later. Change the test to fs->clusters + 1 to fix. Reported-by: Hanno Böck Signed-off-by: Andreas Bombe <aeb@debian.org> --- src/fat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: dosfstools-3.0.26/src/fat.c =================================================================== --- dosfstools-3.0.26.orig/src/fat.c +++ dosfstools-3.0.26/src/fat.c @@ -199,7 +199,7 @@ void set_fat(DOS_FS * fs, uint32_t clust FAT_ENTRY subseqEntry; get_fat(&subseqEntry, fs->fat, cluster + 1, fs); data[0] = new & 0xff; - data[1] = (new >> 8) | (cluster == fs->clusters - 1 ? 0 : + data[1] = (new >> 8) | (cluster == fs->clusters + 1 ? 0 : (0xff & subseqEntry.value) << 4); } size = 2;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor