kumquat-buildroot/package/dosfstools/0001-mkfs-Default-to-64-32-heads-sectors-for-targets-smalle.patch
Gustavo Zacarias a0b0fcfe21 dosfstools: security bump to version 4.0
Fixes:

CVE-2015-8872 - 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
late.

CVE-2016-4804 - the variable used for storing the FAT size (in bytes)
was an unsigned int. Since the size in sectors read from the BPB was not
sufficiently checked, this could end up being zero after multiplying it
with the sector size while some offsets still stayed excessive.
Ultimately it would cause segfaults when accessing FAT entries for which
no memory was allocated.

Converted package to autotools infra to match upstream.

The install options are now removals, enabled compatibilty symlinks and
exec-prefix set to / to match previous install names/locations.

Accounted for optional udev usage.

Dropped musl compatibility patch since it's upstream.

Add upstream patch to keep sectors a multiple of sectors per track since
it makes mtools cranky.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2016-05-31 13:21:25 +02:00

43 lines
1.3 KiB
Diff

From 1e76e5778a1885452939a79d9145b80634a5b023 Mon Sep 17 00:00:00 2001
From: Andreas Bombe <aeb@debian.org>
Date: Wed, 11 May 2016 03:44:58 +0200
Subject: [PATCH] mkfs: Default to 64/32 heads/sectors for targets smaller than
512 MB
This may put defaults in certain use cases a little bit more in line
with the old defaults in versions up to 3.0.28. It has mostly aesthetic
value in most cases.
Signed-off-by: Andreas Bombe <aeb@debian.org>
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
Patch status: upstream
src/mkfs.fat.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/mkfs.fat.c b/src/mkfs.fat.c
index 8a320fd..bad492b 100644
--- a/src/mkfs.fat.c
+++ b/src/mkfs.fat.c
@@ -519,6 +519,16 @@ static void establish_params(struct device_info *info)
unsigned int cluster_size = 4; /* starting point for FAT12 and FAT16 */
int def_root_dir_entries = 512;
+ if (info->size < 512 * 1024 * 1024) {
+ /*
+ * These values are more or less meaningless, but we can at least
+ * use less extreme values for smaller filesystems where the large
+ * dummy values signifying LBA only access are not needed.
+ */
+ sec_per_track = 32;
+ heads = 64;
+ }
+
if (info->type != TYPE_FIXED) {
/* enter default parameters for floppy disks if the size matches */
switch (info->size / 1024) {
--
2.7.3