Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for NULL when looking up getenv("HOME"). #3980

Merged
merged 1 commit into from Sep 12, 2014

Conversation

quickfur
Copy link
Member

Fixes: https://issues.dlang.org/show_bug.cgi?id=12130

This bug is caused by dmd attempting to look up a literal '~' in $PATH, but when HOME is not set, getenv("HOME") returns NULL, which causes strlen to segfault. Note that this only happens if the user's $PATH environment variable contains a literal ~; usually, in bash, attempting to set ~ in HOME will cause the ~ to be autoexpanded to the value of HOME, so to reproduce this bug, you have to escape the ~, like so:

export PATH=\~:$PATH
unset HOME
dmd  # <--- segfaults

Question: This bug requires a specific runtime environment for dmd; does the testsuite provide facilities for testing this sort of thing?

@yebblies
Copy link
Member

A lot of dmd's driver code has zero test suite coverage.

@yebblies
Copy link
Member

Auto-merge toggled on

yebblies added a commit that referenced this pull request Sep 12, 2014
Check for NULL when looking up getenv("HOME").
@yebblies yebblies merged commit 9b6ecad into dlang:master Sep 12, 2014
@quickfur quickfur deleted the issue12130 branch September 12, 2014 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants