[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);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Timo Kreuzer 2019-04-28 15:50:08 +02:00
parent 3120320c65
commit 791b1ad7bd

View file

@ -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);
}