summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorPaulo Alcantara <pcacjr@gmail.com>2012-01-23 23:38:58 -0300
committerPaulo Alcantara <pcacjr@gmail.com>2012-02-11 16:06:07 -0300
commit05f0ebc97acea07c9b76d7ebf88d7a82222631a1 (patch)
tree19ab53757534164c2cf43ff214a229a9d910addb /core
parentcfc2e54fea6a1381733392dc4ac2807dac46090c (diff)
downloadsyslinux-05f0ebc97acea07c9b76d7ebf88d7a82222631a1.tar.gz
ntfs: add missing field in ntfs_attr_list_entry structure
This missing field just messed up when reading the ntfs_attr_list_entry's fields to be used in any case. Also add a check to avoid reading the same MFT record which contains the attribute list and also the wanted attribute type. Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Diffstat (limited to 'core')
-rw-r--r--core/fs/ntfs/ntfs.c20
-rw-r--r--core/fs/ntfs/ntfs.h1
2 files changed, 15 insertions, 6 deletions
diff --git a/core/fs/ntfs/ntfs.c b/core/fs/ntfs/ntfs.c
index 8bf53a72..9170015e 100644
--- a/core/fs/ntfs/ntfs.c
+++ b/core/fs/ntfs/ntfs.c
@@ -417,7 +417,7 @@ out:
static const struct ntfs_mft_record *
ntfs_attr_list_lookup(struct fs_info *fs, struct ntfs_attr_record *attr,
- uint32_t type)
+ uint32_t type, const struct ntfs_mft_record *mrec)
{
uint8_t *attr_len;
struct mapping_chunk chunk;
@@ -433,7 +433,7 @@ ntfs_attr_list_lookup(struct fs_info *fs, struct ntfs_attr_record *attr,
block_t blk;
struct ntfs_attr_list_entry *attr_entry;
uint32_t len = 0;
- struct ntfs_mft_record *mrec;
+ struct ntfs_mft_record *retval;
uint64_t start_blk = 0;
dprintf("in %s\n", __func__);
@@ -514,14 +514,22 @@ found:
* will look for the MFT record that stores information about this
* attribute.
*/
- mrec = NTFS_SB(fs)->mft_record_lookup(fs, attr_entry->mft_ref, &start_blk);
- if (!mrec) {
+
+ /* Check if the attribute type we're looking for is in the same
+ * MFT record. If so, we do not need to look it up again - return it.
+ */
+ if (mrec->mft_record_no == attr_entry->mft_ref)
+ return mrec;
+
+ retval = NTFS_SB(fs)->mft_record_lookup(fs, attr_entry->mft_ref,
+ &start_blk);
+ if (!retval) {
printf("No MFT record found!\n");
goto out;
}
/* return the found MFT record */
- return mrec;
+ return retval;
}
static struct ntfs_attr_record *
@@ -562,7 +570,7 @@ again:
* it as well.
*/
if (attr->type == NTFS_AT_END && attr_list_attr) {
- mrec = ntfs_attr_list_lookup(fs, attr_list_attr, type);
+ mrec = ntfs_attr_list_lookup(fs, attr_list_attr, type, mrec);
if (!mrec)
goto out;
diff --git a/core/fs/ntfs/ntfs.h b/core/fs/ntfs/ntfs.h
index 3f2b260d..c6aa0745 100644
--- a/core/fs/ntfs/ntfs.h
+++ b/core/fs/ntfs/ntfs.h
@@ -309,6 +309,7 @@ struct ntfs_attr_record {
struct ntfs_attr_list_entry {
uint32_t type;
uint16_t length;
+ uint8_t name_length;
uint8_t name_offset;
uint64_t lowest_vcn;
uint64_t mft_ref;