]> git.ipfire.org Git - thirdparty/util-linux.git/commit
last: do not use non-standard __UT_NAMESIZE
authorPatrick Steinhardt <ps@pks.im>
Fri, 1 Mar 2019 17:35:49 +0000 (18:35 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 4 Mar 2019 10:38:28 +0000 (11:38 +0100)
commit72aa1db70c59e6bb43afc4315cef00db3ecfef84
tree629ca9d2ebbcf27c04e2fcf2f59ae889a700b1fa
parent89342e0406209f195bf7a1a5396ac74c16470ac6
last: do not use non-standard __UT_NAMESIZE

In commit b22332dd4 (last: fix wtmp user name buffer overflow
[asan], 2019-01-13), we started to make sure that the `ut_user`
field of the `utmpx` struct is always NUL-terminated. The
implementation makes use of the `__UT_NAMESIZE` define to
determine the position of the last character in that array. The
problem is that this is a non-standard define that is not
necessarily available on non-glibc platforms.

As there is no standardized define, we should just use `sizeof`.
This fixes compilation on musl libc based systems.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
login-utils/last.c