From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#35283: [PATCH] mformat: initialize boot sector before writing it Date: Sun, 21 Apr 2019 01:03:57 +0200 Message-ID: <87y3448ejm.fsf_-_@gnu.org> References: <875zrafck7.fsf_-_@gnu.org> <11201672983044432889@scdbackup.webframe.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:60638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHzEL-0000SH-6f for bug-guix@gnu.org; Sat, 20 Apr 2019 19:17:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHz2d-00066b-Rl for bug-guix@gnu.org; Sat, 20 Apr 2019 19:05:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33483) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hHz2b-00065q-Ur for bug-guix@gnu.org; Sat, 20 Apr 2019 19:05:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hHz2b-0007i6-Jv for bug-guix@gnu.org; Sat, 20 Apr 2019 19:05:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <11201672983044432889@scdbackup.webframe.org> (Thomas Schmitt's message of "Fri, 19 Apr 2019 14:46:48 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: info-mtools@gnu.org Cc: 35283@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, While investigating reproducible ISO images for Guix=C2=B9, I found that =E2=80=98mformat=E2=80=99 would not initialize the boot sector before writi= ng it. This led to non-deterministic FAT image contents. The attached patch fixes that. Thanks, Ludo=E2=80=99. =C2=B9 https://issues.guix.info/issue/35283 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=mtools-mformat-uninitialized.patch Content-Transfer-Encoding: quoted-printable Content-Description: the patch 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=C3=A8s . --- 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 =20=09 char *endptr; =20 + memset(&boot.bytes, '\0', sizeof boot); hs =3D hs_set =3D 0; argtracks =3D 0; argheads =3D 0; --=-=-=--