mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-08 21:17:47 +03:00
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
This commit is contained in:
parent
00b333bb10
commit
57cd09acf2
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user