Fix segfault for LDAP-authenticated users#860
Open
aaronokano wants to merge 1 commit intojonls:masterfrom
Open
Fix segfault for LDAP-authenticated users#860aaronokano wants to merge 1 commit intojonls:masterfrom
aaronokano wants to merge 1 commit intojonls:masterfrom
Conversation
If a user is logged in via LDAP, some implementations of getpwuid() seem to return NULL. Dereferencing this pointer will cause a segfault. This change avoids dereferencing the potential NULL pointer.
|
Thanks for the patch! LGTM, I hope the owners can soon merge this. |
rumpeltux
added a commit
to rumpeltux/redshift
that referenced
this pull request
Apr 18, 2022
Related bugs: * https://bugzilla.suse.com/show_bug.cgi?id=1111906 * https://bugs.debian.org/988068 * jonls#672 * jonls#860 src/config-ini.c still looks for $HOME/.config/redshift.conf which fails to open because the apparmor profile doesn’t allow it. src/config-ini.c also does this: struct passwd *pwd = getpwuid(getuid()); char *home = pwd->pw_dir; Since getpwuid doesn’t have access to /etc/passwd* it returns NULL, causing a segmentation fault in the line thereafter. This code is not triggered if a config is specified (e.g. -c redshift.conf) or $HOME/.config/redshift.conf exists.
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.
If a user is logged in via LDAP, some implementations of getpwuid() seem
to return NULL. Dereferencing this pointer will cause a segfault. This
change avoids dereferencing the potential NULL pointer.