Skip to content
Commit f0cd1cfb authored by Florian Weimer's avatar Florian Weimer
Browse files

login: pututxline could fail to overwrite existing entries [BZ #24902]



The internal_getut_r function updates the file_offset variable and
therefore must always update last_entry as well.

Previously, if pututxline could not upgrade the read lock to a
write lock, internal_getut_r would update file_offset only,
without updating last_entry, and a subsequent call would not
overwrite the existing utmpx entry at file_offset, instead
creating a new entry.  This has been observed to cause unbounded
file growth in high-load situations.

This commit removes the buffer argument to internal_getut_r and
updates the last_entry variable directly, along with file_offset.

Initially reported and fixed by Ondřej Lysoněk.

Reviewed-by: default avatarGabriel F. T. Gomes <gabrielftg@linux.ibm.com>
(cherry picked from commit 61d3db42)
parent dbbd748c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment