summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-08-23 22:35:03 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-08-27 21:05:28 -0400
commit57cd09acf2c63a414aa2131c00a2b3f600eb0133 (patch)
treec650e6d612f6da0515261332c3cc59a5f33febe0 /src/journal
parent00b333bb1039809a42ba4c7f25ba85f68766477d (diff)
sd-journal: properly convert object->size on big endian
mmap code crashes when attempting to map an object of zero size. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758392 https://bugs.freedesktop.org/show_bug.cgi?id=82894
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journal-file.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h
index 3d416820b0..da2ef3b795 100644
--- a/src/journal/journal-file.h
+++ b/src/journal/journal-file.h
@@ -214,14 +214,15 @@ static unsigned type_to_context(int type) {
static inline int journal_file_object_keep(JournalFile *f, Object *o, uint64_t offset) {
unsigned context = type_to_context(o->object.type);
+ uint64_t s = le64toh(o->object.size);
return mmap_cache_get(f->mmap, f->fd, f->prot, context, true,
- offset, o->object.size, &f->last_stat, NULL);
+ offset, s, &f->last_stat, NULL);
}
static inline int journal_file_object_release(JournalFile *f, Object *o, uint64_t offset) {
unsigned context = type_to_context(o->object.type);
+ uint64_t s = le64toh(o->object.size);
- return mmap_cache_release(f->mmap, f->fd, f->prot, context,
- offset, o->object.size);
+ return mmap_cache_release(f->mmap, f->fd, f->prot, context, offset, s);
}