From 4fe7aafe106c2f711058ec15857f05e925fd662f Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 19 Aug 2018 09:55:03 +0200 Subject: [PATCH] [FASTFAT] Magic values-- --- drivers/filesystems/fastfat/dirwr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/filesystems/fastfat/dirwr.c b/drivers/filesystems/fastfat/dirwr.c index b4a2a94b599..ba791fbc607 100644 --- a/drivers/filesystems/fastfat/dirwr.c +++ b/drivers/filesystems/fastfat/dirwr.c @@ -806,9 +806,11 @@ FATAddEntry( { RtlZeroMemory(pFatEntry, DeviceExt->FatInfo.BytesPerCluster); /* create '.' and '..' */ - RtlCopyMemory(&pFatEntry[0].Attrib, &DirContext.DirEntry.Fat.Attrib, sizeof(FAT_DIR_ENTRY) - 11); + RtlCopyMemory(&pFatEntry[0].Attrib, &DirContext.DirEntry.Fat.Attrib, + sizeof(FAT_DIR_ENTRY) - FIELD_OFFSET(FAT_DIR_ENTRY, Attrib)); RtlCopyMemory(pFatEntry[0].ShortName, ". ", 11); - RtlCopyMemory(&pFatEntry[1].Attrib, &DirContext.DirEntry.Fat.Attrib, sizeof(FAT_DIR_ENTRY) - 11); + RtlCopyMemory(&pFatEntry[1].Attrib, &DirContext.DirEntry.Fat.Attrib, + sizeof(FAT_DIR_ENTRY) - FIELD_OFFSET(FAT_DIR_ENTRY, Attrib)); RtlCopyMemory(pFatEntry[1].ShortName, ".. ", 11); }