id: Handle NULL pointer gracefully within cstr2cow macro#7810
Merged
sylvestre merged 4 commits intouutils:mainfrom Apr 23, 2025
Merged
id: Handle NULL pointer gracefully within cstr2cow macro#7810sylvestre merged 4 commits intouutils:mainfrom
cstr2cow macro#7810sylvestre merged 4 commits intouutils:mainfrom
Conversation
> getlogin() returns a pointer to a string containing the name of the user logged in on the controlling terminal of the process, or a NULL pointer if this information cannot be determined. Ref: https://linux.die.net/man/3/getlogin
|
GNU testsuite comparison: |
Contributor
|
i think you can probably add a test here |
sylvestre
reviewed
Apr 21, 2025
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
Segfault fixed by 292fb92
Contributor
Author
|
I suggest trying to see if |
|
GNU testsuite comparison: |
nickorlow
pushed a commit
to nickorlow/coreutils
that referenced
this pull request
Jul 17, 2025
* id: Handle NULL pointer gracefully within `cstr2cow` macro > getlogin() returns a pointer to a string containing the name of the user logged in on the controlling terminal of the process, or a NULL pointer if this information cannot be determined. Ref: https://linux.die.net/man/3/getlogin * id: Remove redundant std::ffi:: prefix from CStr * id: Add comment for the null check Co-authored-by: Sylvestre Ledru <sylvestre@debian.org> * id: Remove skip for test that should not segfault anymore Segfault fixed by 292fb92 --------- Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
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 PR fixes a segmentation fault with the
id -pcommand when thegetloginfunction is unable to determine the logged-in user.Ref: https://linux.die.net/man/3/getlogin
fixes #7808