]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lslogins: use sd_journal_get_data() in proper way
authorKarel Zak <kzak@redhat.com>
Thu, 22 Jul 2021 09:03:54 +0000 (11:03 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 22 Jul 2021 09:09:10 +0000 (11:09 +0200)
commit31d730eb7730f186a0a245f97a09df2fa625f6bd
tree07082dfe956aa16d864b22a3c25005476e14acfd
parentd95d552e36269c1576fc0b043d0b0a3a2c9d63ce
lslogins: use sd_journal_get_data() in proper way

man sd_journal_get_data:
    The returned data is in a read-only memory map and is only valid until the next invocation
    of sd_journal_get_data().

It means that use data after 3x sd_journal_get_data() is really bad
idea. It also seems better to not assume the fields are zero
terminated as journal API works with void* and size_t to address the
data.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1984704
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/lslogins.c