https://git.reactos.org/?p=reactos.git;a=commitdiff;h=791b1ad7bd2bd836668f95b9ba897866d65138f3

commit 791b1ad7bd2bd836668f95b9ba897866d65138f3
Author:     Timo Kreuzer <[email protected]>
AuthorDate: Sun Apr 28 15:50:08 2019 +0200
Commit:     Timo Kreuzer <[email protected]>
CommitDate: Sat Jul 20 13:56:18 2019 +0200

    [FASTFAT] Copy an entire field, instead of half-copying it with 
RtlCopyMemory
    
    Fixes GCC 8 warning:
    sdk/include/crt/mingw32/intrin_x86.h:76:12: error: 'memmove' offset [21, 
40] from the object at 'DirContext' is out of the bounds of referenced 
subobject 'Attrib' with type 'unsigned char' at offset 19 [-Werror=array-bounds]
         return memmove(dest, source, num);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~
---
 drivers/filesystems/fastfat/dirwr.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/filesystems/fastfat/dirwr.c 
b/drivers/filesystems/fastfat/dirwr.c
index db059e86cf4..2aec457057d 100644
--- a/drivers/filesystems/fastfat/dirwr.c
+++ b/drivers/filesystems/fastfat/dirwr.c
@@ -806,11 +806,9 @@ FATAddEntry(
         {
             RtlZeroMemory(pFatEntry, DeviceExt->FatInfo.BytesPerCluster);
             /* create '.' and '..' */
-            RtlCopyMemory(&pFatEntry[0].Attrib, 
&DirContext.DirEntry.Fat.Attrib,
-                          sizeof(FAT_DIR_ENTRY) - FIELD_OFFSET(FAT_DIR_ENTRY, 
Attrib));
+            pFatEntry[0] = DirContext.DirEntry.Fat;
             RtlCopyMemory(pFatEntry[0].ShortName, ".          ", 11);
-            RtlCopyMemory(&pFatEntry[1].Attrib, 
&DirContext.DirEntry.Fat.Attrib,
-                          sizeof(FAT_DIR_ENTRY) - FIELD_OFFSET(FAT_DIR_ENTRY, 
Attrib));
+            pFatEntry[1] = DirContext.DirEntry.Fat;
             RtlCopyMemory(pFatEntry[1].ShortName, "..         ", 11);
         }
 

Reply via email to