mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
sd-journal: check validity of object type more strictly
Otherwise, the object with invalid type may pass check_object_header() when the requested type is OBJECT_UNUSED.
This commit is contained in:
parent
3092eaa72e
commit
b72fd2af86
@ -791,10 +791,10 @@ static int check_object_header(JournalFile *f, Object *o, ObjectType type, uint6
|
||||
"Attempt to move to overly short object with size %"PRIu64": %" PRIu64,
|
||||
s, offset);
|
||||
|
||||
if (o->object.type <= OBJECT_UNUSED)
|
||||
if (o->object.type <= OBJECT_UNUSED || o->object.type >= _OBJECT_TYPE_MAX)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG),
|
||||
"Attempt to move to object with invalid type: %" PRIu64,
|
||||
offset);
|
||||
"Attempt to move to object with invalid type (%u): %" PRIu64,
|
||||
o->object.type, offset);
|
||||
|
||||
if (type > OBJECT_UNUSED && o->object.type != type)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG),
|
||||
|
Loading…
Reference in New Issue
Block a user