]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/utmp.c: Fixed generated strings for "ut_id"
authorEvgeny Grin (Karlson2k) <k2k@drgrin.dev>
Mon, 14 Jul 2025 20:05:21 +0000 (22:05 +0200)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Thu, 17 Jul 2025 10:55:02 +0000 (12:55 +0200)
commitf86d60f9d3a8ed0a4b09610f2156a1438ff807ce
tree9b94d4353a81c035c0152ba9efe22b827468b6ec
parentdc2c85d7540b6518afdd28622839e9e02cca1a0a
lib/utmp.c: Fixed generated strings for "ut_id"

When no "ut_id" is provided by previous utmp file entry, "login" must
generate its own "ut_id". Historically tty number  was used for it.
However, if current device name is three characters or shorter, then
empty "ut_id" is produced or even garbage is copied from uninitialised
part of the "line".
This commit fixes it.
This patch uses unportable C extension Elvis operator as it is already
used everywhere in the code.

Signed-off-by: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
lib/utmp.c