Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Fix segfault for LDAP-authenticated users#860

Open
aaronokano wants to merge 1 commit into
sharpbracket:master from
aaronokano:fix-getpwuid-null-segfault
Open

Fix segfault for LDAP-authenticated users #860
aaronokano wants to merge 1 commit into
sharpbracket:master from
aaronokano:fix-getpwuid-null-segfault

Conversation

@aaronokano

@aaronokano aaronokano commented Feb 24, 2022

Copy link
Copy Markdown

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.

rumpeltux and h3xx reacted with thumbs up emoji
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.

Copy link
Copy Markdown

Thanks for the patch! LGTM, I hope the owners can soon merge this.
This can also happen if the apparmor profile that comes with debian is enabled which doesn’t grant read access to /etc/passwd*.

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
 * sharpbracket#672
 * sharpbracket#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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /