From 1b0b1651b16bd67fa5a583cfe6ce98ac9df80e56 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 21 Apr 2019 00:46:44 +0200 Subject: gnu: mtools: 'mformat' initializes boot sector before writing it. This is the last bit fixing . Previously, 'mformat' (used by 'grub-mkrescue') would pass uninitialized bytes to write(2), leading to non-deterministic FAT image contents. This patch fixes that. * gnu/packages/patches/mtools-mformat-uninitialized.patch: New file. * gnu/packages/mtools.scm (mtools)[source]: Use it. * gnu/local.mk (dist_patch_DATA): Add it. --- .../patches/mtools-mformat-uninitialized.patch | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gnu/packages/patches/mtools-mformat-uninitialized.patch (limited to 'gnu/packages/patches/mtools-mformat-uninitialized.patch') diff --git a/gnu/packages/patches/mtools-mformat-uninitialized.patch b/gnu/packages/patches/mtools-mformat-uninitialized.patch new file mode 100644 index 0000000000..ae69d45c99 --- /dev/null +++ b/gnu/packages/patches/mtools-mformat-uninitialized.patch @@ -0,0 +1,20 @@ +Fix a bug whereby 'mformat' could end up passing uninitialized bytes +to write(2). This could be reproduced with: + + mformat -C -f 1440 -L 16 -N 77777777 -i /tmp/x :: + +where the output of /tmp/x would be non-deterministic. + +Patch by Ludovic Courtès . + +--- mtools-4.0.23/mformat.c 2019-04-21 00:12:01.496116195 +0200 ++++ mtools-4.0.23/mformat.c 2019-04-21 00:12:36.675967157 +0200 +@@ -927,6 +927,7 @@ void mformat(int argc, char **argv, int + + char *endptr; + ++ memset(&boot.bytes, '\0', sizeof boot); + hs = hs_set = 0; + argtracks = 0; + argheads = 0; + -- cgit v1.2.3