]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/utmp.c: Fix use of last utmp entry instead of patrial-match entry master
authorEvgeny Grin (Karlson2k) <k2k@drgrin.dev>
Sun, 10 Aug 2025 12:08:18 +0000 (14:08 +0200)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Sun, 10 Aug 2025 13:58:21 +0000 (15:58 +0200)
commit5958f656cc82cefc02f2d78ebd68f4baeb329bf8
tree7f281e12749c635a2b1363263a67c5bfe99e9b30
parentbff2961dbe24436f7f2b508bf489007aa73425b8
lib/utmp.c: Fix use of last utmp entry instead of patrial-match entry

The pointer returned by getutxent() function may always point to
the same shared and reused buffer.

Instead of copying the utmp entry pointer value the content of utmp
entry must be copied otherwise the next call of getutxent() will
overwrite previously found entry.

This commit has no optimisations to highlight what is really fixed.

Fixes: 841776561f56bae7382c6bd47e428201a155d39c (09-08-2025; "lib/utmp.c: Fix umtp entry search")
Signed-off-by: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
lib/utmp.c