# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/dosfstools/58e0c95106d43b0df9ccb8d1edef00949bc8b4e7.patch # Copyright (C) 2022 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-END --- From 58e0c95106d43b0df9ccb8d1edef00949bc8b4e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Wed, 16 Mar 2022 01:24:22 +0100 Subject: [PATCH] fsck.fat: Add missing __attribute__ ((packed)) for disk structures It is required for proper pointer aligning and also for preventing to fill gaps between structure members. Fixes #176 --- src/fsck.fat.h | 2 +- src/lfn.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsck.fat.h b/src/fsck.fat.h index eaab6a9..5cbd838 100644 --- a/src/fsck.fat.h +++ b/src/fsck.fat.h @@ -124,7 +124,7 @@ struct info_sector { uint32_t next_cluster; /* Most recently allocated cluster. */ uint8_t reserved2[12]; uint32_t boot_sign; -}; +} __attribute__ ((packed)); typedef struct { uint8_t name[MSDOS_NAME]; /* name including extension */ diff --git a/src/lfn.c b/src/lfn.c index 96464df..495bd82 100644 --- a/src/lfn.c +++ b/src/lfn.c @@ -43,7 +43,7 @@ typedef struct { uint8_t name5_10[12]; /* 6 more characters in name */ uint16_t start; /* starting cluster number, 0 in long slots */ uint8_t name11_12[4]; /* last 2 characters in name */ -} LFN_ENT; +} __attribute__ ((packed)) LFN_ENT; #define LFN_ID_START 0x40 #define LFN_ID_SLOTMASK 0x1f