summaryrefslogtreecommitdiff
path: root/libparted
diff options
context:
space:
mode:
authorBrian C. Lane <bcl@redhat.com>2020-11-12 16:18:42 -0800
committerBrian C. Lane <bcl@redhat.com>2020-11-20 14:00:58 -0800
commite2ee2628c5d75b375db90a486b906c0d2405b8b3 (patch)
tree2aa089ce1cfb1cc6e00fdcba2031ac996b78ef86 /libparted
parent362571d09da09fb2b6fab7037af26d83b2d39b75 (diff)
downloadparted-e2ee2628c5d75b375db90a486b906c0d2405b8b3.tar.gz
ntfs: Fix gcc 10 warnings about cast alignment
Diffstat (limited to 'libparted')
-rw-r--r--libparted/fs/ntfs/ntfs.c11
1 files 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;
}