summaryrefslogtreecommitdiff
path: root/include/meta_reader.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-23 12:10:16 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-23 12:10:16 +0200
commit029a8db2701afb0653c6e789c878bb768ceb87e1 (patch)
tree86b1c8406d6c7755d19017d98406177660403f54 /include/meta_reader.h
parent7c028e224978e1d5a4f207cc42b9eb58d81897dd (diff)
Do bounds checking in metadata reader
In all cases where metadata blocks are read, we can roughly (in some cases even preciesly) say in what range those metadata blocks will be, so it makes sense to throw an error if an attempt is made to wander outside this range. Furthermore, when reading from an uncompressed block, it is more reasonable to check against the actual block bounds than to padd it with 0 bytes. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/meta_reader.h')
-rw-r--r--include/meta_reader.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/meta_reader.h b/include/meta_reader.h
index 8369ad3..d5628af 100644
--- a/include/meta_reader.h
+++ b/include/meta_reader.h
@@ -15,8 +15,13 @@
typedef struct meta_reader_t meta_reader_t;
/* Create a meta data reader using a given compressor to extract data.
- Internally prints error message to stderr on failure. */
-meta_reader_t *meta_reader_create(int fd, compressor_t *cmp);
+ Internally prints error message to stderr on failure.
+
+ Start offset and limit can be specified to do bounds checking against
+ a subregion of the filesystem image.
+*/
+meta_reader_t *meta_reader_create(int fd, compressor_t *cmp,
+ uint64_t start, uint64_t limit);
void meta_reader_destroy(meta_reader_t *m);