diff --git a/include/ntfs-3g/endians.h b/include/ntfs-3g/endians.h index 291eccec..07ae2221 100644 --- a/include/ntfs-3g/endians.h +++ b/include/ntfs-3g/endians.h @@ -304,4 +304,6 @@ #define sle16_eq(a, b) ((a) == (b)) +#define sle64_eq(a, b) ((a) == (b)) + #endif /* defined _NTFS_ENDIANS_H */ diff --git a/libntfs-3g/attrlist.c b/libntfs-3g/attrlist.c index 9c62f316..450f0980 100644 --- a/libntfs-3g/attrlist.c +++ b/libntfs-3g/attrlist.c @@ -155,7 +155,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) le16_to_cpu(attr->value_offset)), (attr->non_resident) ? 0 : le32_to_cpu(attr->value_length), ctx)) { /* Found some extent, check it to be before new extent. */ - if (ctx->al_entry->lowest_vcn == attr->lowest_vcn) { + if (sle64_eq(ctx->al_entry->lowest_vcn, attr->lowest_vcn)) { err = EEXIST; ntfs_log_trace("Such attribute already present in the " "attribute list.\n"); diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index fc55cc61..b1005c23 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -871,7 +871,7 @@ static BOOL attrlist_selfloc_condition(struct MFT_SELF_LOCATED *selfloc) && al->length && le32_eq(al->type, AT_DATA) && !al->name_length - && ((leVCN)al->lowest_vcn == levcn) + && sle64_eq(al->lowest_vcn, levcn) && (MREF_LE(al->mft_reference) >= SELFLOC_LIMIT)) { selfloc->mft_ref1 = le64_to_cpu(al->mft_reference);