From 07b1e1a36119174f0939dda50f009f2f8436088d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 22:43:10 +0000 Subject: [PATCH] Add check for new attribute size being large enough to store the attribute length in ntfs_attr_rec_resize(). (Logical change 1.561) --- libntfs/attrib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index f49c8ee1..0cf56b07 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2258,7 +2258,8 @@ int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size) /* Adjust @m to reflect the change in used space. */ m->bytes_in_use = cpu_to_le32(new_muse); /* Adjust @a to reflect the new size. */ - a->length = cpu_to_le32(new_size); + if (new_size >= offsetof(ATTR_REC, length) + sizeof(a->length)) + a->length = cpu_to_le32(new_size); } return 0; }