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)
edge.strict_endians
antona 2005-10-15 23:13:49 +00:00
parent 3adf923766
commit 1d4958d38c
3 changed files with 7 additions and 4 deletions

View File

@ -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.

View File

@ -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!");

View File

@ -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 "