From 1ea2003e961f0c552c1c951555f3ba9be3333ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Wed, 19 Dec 2018 15:48:03 +0100 Subject: [PATCH] Realigned times set from extended attribute The alignment of times set in an extended attribute value cannot be asserted, and this cause alignment errors on some CPUs (met on ARM). Be safe by copying them in a properly aligned array. --- libntfs-3g/inode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libntfs-3g/inode.c b/libntfs-3g/inode.c index 01430210..b25f4051 100644 --- a/libntfs-3g/inode.c +++ b/libntfs-3g/inode.c @@ -1518,14 +1518,16 @@ int ntfs_inode_set_times(ntfs_inode *ni, const char *value, size_t size, ntfs_attr_search_ctx *ctx; STANDARD_INFORMATION *std_info; FILE_NAME_ATTR *fn; - const u64 *times; + u64 times[4]; ntfs_time now; int cnt; int ret; ret = -1; if ((size >= 8) && !(flags & XATTR_CREATE)) { - times = (const u64*)value; + /* Copy, to avoid alignment issue encountered on ARM */ + memcpy(times, value, + (size < sizeof(times) ? size : sizeof(times))); now = ntfs_current_time(); /* update the standard information attribute */ ctx = ntfs_attr_get_search_ctx(ni, NULL);