mirror of
https://github.com/systemd/systemd.git
synced 2024-10-28 20:25:38 +03:00
journal: fix field retrieval by name
This commit is contained in:
parent
3fbf9cbb02
commit
161e54f871
@ -493,12 +493,9 @@ int sd_journal_get_field(sd_journal *j, const char *field, const void **data, si
|
|||||||
|
|
||||||
l = le64toh(o->object.size) - offsetof(Object, data.payload);
|
l = le64toh(o->object.size) - offsetof(Object, data.payload);
|
||||||
|
|
||||||
if (field_length+1 > l)
|
if (l >= field_length+1 &&
|
||||||
continue;
|
memcmp(o->data.payload, field, field_length) == 0 &&
|
||||||
|
o->data.payload[field_length] == '=') {
|
||||||
if (memcmp(o->data.payload, field, field_length) ||
|
|
||||||
o->data.payload[field_length] != '=')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
t = (size_t) l;
|
t = (size_t) l;
|
||||||
|
|
||||||
@ -511,6 +508,11 @@ int sd_journal_get_field(sd_journal *j, const char *field, const void **data, si
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r = journal_file_move_to_object(f, f->current_offset, OBJECT_ENTRY, &o);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user