From 504e6fcec0b81150cfa20462e40e91bb3ecfb365 Mon Sep 17 00:00:00 2001 From: jpandre Date: Sat, 7 Nov 2009 08:31:17 +0000 Subject: [PATCH] Fixed locating a Windows junction or symlink when last entry in an index node --- libntfs-3g/reparse.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libntfs-3g/reparse.c b/libntfs-3g/reparse.c index 6ac96c6e..20934436 100644 --- a/libntfs-3g/reparse.c +++ b/libntfs-3g/reparse.c @@ -151,6 +151,7 @@ static u64 ntfs_fix_file_name(ntfs_inode *dir_ni, ntfschar *uname, int olderrno; int i; u32 cpuchar; + INDEX_ENTRY *entry; FILE_NAME_ATTR *found; struct { FILE_NAME_ATTR attr; @@ -185,8 +186,13 @@ static u64 ntfs_fix_file_name(ntfs_inode *dir_ni, ntfschar *uname, * We generally only get the first matching candidate, * so we still have to check whether this is a real match */ - if (icx->data && icx->data_len) { - found = (FILE_NAME_ATTR*)icx->data; + if (icx->entry && (icx->entry->ie_flags & INDEX_ENTRY_END)) + /* get next entry if reaching end of block */ + entry = ntfs_index_next(icx->entry, icx); + else + entry = icx->entry; + if (entry) { + found = &entry->key.file_name; if (lkup && !ntfs_names_collate(find.attr.file_name, find.attr.file_name_length,