Fixed the computation of named attributes sizes in mkntfs

The named attributes sizes were wrongly computed in mkntfs. This did not
lead to visible errors so far owing to 8-byte alignments in attribute
records (current names $SDS, $R, $O, etc).
edge.strict_endians
Jean-Pierre André 2012-08-20 13:57:00 +02:00
parent f793ead700
commit 262a0559ac
1 changed files with 2 additions and 2 deletions

View File

@ -1788,7 +1788,7 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m,
}
a = ctx->attr;
/* sizeof(resident attribute record header) == 24 */
asize = ((24 + ((name_len + 7) & ~7) + val_len) + 7) & ~7;
asize = ((24 + ((name_len*2 + 7) & ~7) + val_len) + 7) & ~7;
err = make_room_for_attribute(m, (char*)a, asize);
if (err == -ENOSPC) {
/*
@ -1831,7 +1831,7 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m,
m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance)
+ 1) & 0xffff);
a->value_length = cpu_to_le32(val_len);
a->value_offset = cpu_to_le16(24 + ((name_len + 7) & ~7));
a->value_offset = cpu_to_le16(24 + ((name_len*2 + 7) & ~7));
a->resident_flags = res_flags;
a->reservedR = 0;
if (name_len)