From e2ee2628c5d75b375db90a486b906c0d2405b8b3 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 12 Nov 2020 16:18:42 -0800 Subject: [PATCH 32/42] ntfs: Fix gcc 10 warnings about cast alignment --- libparted/fs/ntfs/ntfs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libparted/fs/ntfs/ntfs.c b/libparted/fs/ntfs/ntfs.c index 3bfb28e..a3a6550 100644 --- a/libparted/fs/ntfs/ntfs.c +++ b/libparted/fs/ntfs/ntfs.c @@ -35,16 +35,17 @@ PedGeometry* ntfs_probe (PedGeometry* geom) { - char *buf = alloca (geom->dev->sector_size); + uint8_t *buf = alloca(geom->dev->sector_size); PedGeometry *newg = NULL; if (!ped_geometry_read(geom, buf, 0, 1)) return 0; - if (strncmp (NTFS_SIGNATURE, buf + 3, strlen (NTFS_SIGNATURE)) == 0) - newg = ped_geometry_new (geom->dev, geom->start, - PED_LE64_TO_CPU (*(uint64_t*) - (buf + 0x28))); + if (strncmp (NTFS_SIGNATURE, ((char *)buf + 3), strlen (NTFS_SIGNATURE)) == 0) { + uint64_t length; + memcpy(&length, buf + 0x28, sizeof(uint64_t)); + newg = ped_geometry_new (geom->dev, geom->start, length); + } return newg; } -- 2.26.2