lib/utmp.c: Fix use of last utmp entry instead of patrial-match entry#1326
Merged
alejandro-colomar merged 1 commit intoAug 10, 2025
Merged
Conversation
Contributor
Author
|
@ikerexxe Please, take a look on it. |
3e684ab to
fa3c354
Compare
Contributor
Author
|
Updated with separated fix and refactors. The fix is really simple. Can be used alone, without refactors. |
fa3c354 to
b8a06bc
Compare
Contributor
Author
|
Added an alternative version #1327 with full revert as the first commit. |
b8a06bc to
be066b9
Compare
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: 8417765 (09-08-2025; "lib/utmp.c: Fix umtp entry search") Signed-off-by: Evgeny Grin (Karlson2k) <[email protected]>
be066b9 to
92fd0eb
Compare
alejandro-colomar
approved these changes
Aug 10, 2025
Collaborator
alejandro-colomar
left a comment
There was a problem hiding this comment.
Thanks! LGTM.
Contributor
Author
|
Thank you! |
Collaborator
No problem! Mistakes happen to everyone. :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a correction for PR #1292.
After additional code and documentation analysis I found out that copy of the pointer is not enough, a deep copy must be used instead.
I also checked glibc sources to be absolutely sure.
I think this kind of code could be improved with additional comments, as currently it is not fully clear that match by PID has priority over match by line (tty).