From d7d38e82d9d02cb5e17a83d8a6585a144af00d12 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 6 Feb 2007 15:11:53 +0000 Subject: [PATCH] fix: don't update ->name_offset if it would underflow --- libntfs-3g/attrib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libntfs-3g/attrib.c b/libntfs-3g/attrib.c index f870e6cb..acec8434 100644 --- a/libntfs-3g/attrib.c +++ b/libntfs-3g/attrib.c @@ -4180,8 +4180,9 @@ retry: memmove((u8*)a + le16_to_cpu(a->name_offset) - 8, (u8*)a + le16_to_cpu(a->name_offset), a->name_length * sizeof(ntfschar)); - a->name_offset = cpu_to_le16(le16_to_cpu( - a->name_offset) - 8); + if (le16_to_cpu(a->name_offset) >= 8) + a->name_offset = cpu_to_le16( + le16_to_cpu(a->name_offset) - 8); a->mapping_pairs_offset = cpu_to_le16(le16_to_cpu( a->mapping_pairs_offset) - 8);