From e1e3e56c54581bf6b020d7b56cef155865b61089 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Dec 2002 15:02:11 +0000 Subject: [PATCH] Fix bug in ntfs_external_attr_find(). Spotted and fixed by Szaka. (Logical change 1.39) --- libntfs/attrib.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 1abd25b3..33c48c8e 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1666,9 +1666,12 @@ not_found: * If we were enumerating and reached the end, we can't just use !@type * because that would return the first attribute instead of the last * one. Thus we just change @type to AT_END which causes - * ntfs_attr_find() to seek to the end. + * ntfs_attr_find() to seek to the end. We also do the same when an + * attribute extent was searched for (i.e. lowest_vcn != 0), as we + * otherwise rewind the search back to the first extent and we get + * that extent returned twice during a search for all extents. */ - if (!type) + if (!type || lowest_vcn) type = AT_END; return ntfs_attr_find(type, name, name_len, ic, val, val_len, ctx); }