mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-11-23 10:04:00 +08:00
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.
This commit is contained in:
parent
e87c853551
commit
1ea2003e96
@ -1518,14 +1518,16 @@ int ntfs_inode_set_times(ntfs_inode *ni, const char *value, size_t size,
|
|||||||
ntfs_attr_search_ctx *ctx;
|
ntfs_attr_search_ctx *ctx;
|
||||||
STANDARD_INFORMATION *std_info;
|
STANDARD_INFORMATION *std_info;
|
||||||
FILE_NAME_ATTR *fn;
|
FILE_NAME_ATTR *fn;
|
||||||
const u64 *times;
|
u64 times[4];
|
||||||
ntfs_time now;
|
ntfs_time now;
|
||||||
int cnt;
|
int cnt;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
if ((size >= 8) && !(flags & XATTR_CREATE)) {
|
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();
|
now = ntfs_current_time();
|
||||||
/* update the standard information attribute */
|
/* update the standard information attribute */
|
||||||
ctx = ntfs_attr_get_search_ctx(ni, NULL);
|
ctx = ntfs_attr_get_search_ctx(ni, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user