diff options
author | H. Peter Anvin <hpa@zytor.com> | 2010-07-05 17:50:13 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-07-05 17:50:13 -0700 |
commit | 31972117a90a7109413bb59e1f33d55fcbdf01db (patch) | |
tree | c71da7e684654760ddaf22e77483c865131a562e /core | |
parent | 91a2ac9e8cba8c52340dd17d7023b9dbd7bd81f9 (diff) | |
download | syslinux-31972117a90a7109413bb59e1f33d55fcbdf01db.tar.gz |
btrfs: print an error if finding compressed/encrypted data
If we find compressed or encrypted data, print an error message
instead of returning garbage. This is suboptimal, but at least
handles the common subcase of an encrypted configuration file.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/fs/btrfs/btrfs.c | 11 | ||||
-rw-r--r-- | core/fs/getfssec.c | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/core/fs/btrfs/btrfs.c b/core/fs/btrfs/btrfs.c index 55dce93c..b6a14e3b 100644 --- a/core/fs/btrfs/btrfs.c +++ b/core/fs/btrfs/btrfs.c @@ -530,10 +530,19 @@ static int btrfs_next_extent(struct inode *inode, uint32_t lstart) ret = search_tree(fs, fs_tree, &search_key, &path); if (ret) { /* impossible */ printf("btrfs: search extent data error!\n"); - return 0; + return -1; } extent_item = *(struct btrfs_file_extent_item *)path.data; + if (extent_item.encryption) { + printf("btrfs: found encrypted data, cannot continue!\n"); + return -1; + } + if (extent_item.compression) { + printf("btrfs: found compressed data, cannot continue!\n"); + return -1; + } + if (extent_item.type == BTRFS_FILE_EXTENT_INLINE) {/* inline file */ /* we fake a extent here, and PVT of inode will tell us */ offset = path.offsets[0] + sizeof(struct btrfs_header) diff --git a/core/fs/getfssec.c b/core/fs/getfssec.c index 3d62d4e6..e099b64e 100644 --- a/core/fs/getfssec.c +++ b/core/fs/getfssec.c @@ -144,6 +144,10 @@ uint32_t generic_getfssec(struct file *file, char *buf, if (!inode->this_extent.len) { /* Doesn't matter if it's contiguous... */ inode->this_extent = inode->next_extent; + if (!inode->next_extent.len) { + sectors = 0; /* Failed to get anything... we're dead */ + break; + } } else if (inode->next_extent.len && inode->next_extent.pstart == next_pstart(&inode->this_extent)) { /* Coalesce extents and loop */ |