[FASTFAT] Magic values--
authorPierre Schweitzer <pierre@reactos.org>
Sun, 19 Aug 2018 07:55:03 +0000 (09:55 +0200)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 19 Aug 2018 07:56:12 +0000 (09:56 +0200)
drivers/filesystems/fastfat/dirwr.c

index b4a2a94..ba791fb 100644 (file)
@@ -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);
         }