projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1000522
)
sd-journal: detect earlier if we try to read an object from an invalid offset
author
Lennart Poettering
<lennart@poettering.net>
Mon, 25 Apr 2016 19:42:15 +0000
(21:42 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Tue, 26 Apr 2016 10:00:02 +0000
(12:00 +0200)
Specifically, detect early if we try to read from offset 0, i.e. are using
uninitialized offset data.
src/journal/journal-file.c
patch
|
blob
|
history
diff --git
a/src/journal/journal-file.c
b/src/journal/journal-file.c
index
ac6c30f
..
c431863
100644
(file)
--- a/
src/journal/journal-file.c
+++ b/
src/journal/journal-file.c
@@
-709,6
+709,10
@@
int journal_file_move_to_object(JournalFile *f, ObjectType type, uint64_t offset
if (!VALID64(offset))
return -EFAULT;
+ /* Object may not be located in the file header */
+ if (offset < le64toh(f->header->header_size))
+ return -EBADMSG;
+
r = journal_file_move_to(f, type, false, offset, sizeof(ObjectHeader), &t);
if (r < 0)
return r;