diff --git a/ChangeLog b/ChangeLog index 2239e235..f61d5105 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,9 @@ xx/xx/2005 - 1.12.2-WIP compilation failure was because we use strnlen() which is gnu specific and not present on my current version of OSX so ntfsdecrypt now provides own version if it is not present on system. (Anton) + - Fix endianness bug (le16 instead of le32 when accessing mft record + bytes_in_use) in volume.c::ntfs_volume_write_flags() and + ntfsfix.c::OLD_ntfs_volume_set_flags(). (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/libntfs/volume.c b/libntfs/volume.c index 92935a73..8c1108aa 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1509,9 +1509,9 @@ int ntfs_volume_write_flags(ntfs_volume *vol, const u16 flags) /* Get a pointer to the value of the attribute. */ c = (VOLUME_INFORMATION*)(le16_to_cpu(a->value_offset) + (char*)a); /* Sanity checks. */ - if ((char*)c + le32_to_cpu(a->value_length) > - le16_to_cpu(ctx->mrec->bytes_in_use) + - (char*)ctx->mrec || le16_to_cpu(a->value_offset) + + if ((char*)c + le32_to_cpu(a->value_length) > (char*)ctx->mrec + + le32_to_cpu(ctx->mrec->bytes_in_use) || + le16_to_cpu(a->value_offset) + le32_to_cpu(a->value_length) > le32_to_cpu(a->length)) { Dputs("Error: Attribute $VOLUME_INFORMATION in $Volume is " "corrupt!"); diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index eab2426d..de871a95 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -210,7 +210,7 @@ static int OLD_ntfs_volume_set_flags(ntfs_volume *vol, const u16 flags) c = (VOLUME_INFORMATION*)(le16_to_cpu(a->value_offset) + (char*)a); /* Sanity checks. */ if ((char*)c + le32_to_cpu(a->value_length) > - le16_to_cpu(m->bytes_in_use) + (char*)m || + (char*)m + le32_to_cpu(m->bytes_in_use) || le16_to_cpu(a->value_offset) + le32_to_cpu(a->value_length) > le32_to_cpu(a->length)) { Dputs("Error: Attribute $VOLUME_INFORMATION in $Volume is "