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

config_file: properly ignore includes without "path" value #4832

Merged
merged 2 commits into from
Oct 5, 2018

Conversation

pks-t
Copy link
Member

@pks-t pks-t commented Oct 5, 2018

config_file: properly ignore includes without "path" value

In case a configuration includes a key "include.path=" without any
value, the generated configuration entry will have its value set to
NULL. This is unexpected by the logic handling includes, and as soon
as we try to calculate the included path we will unconditionally
dereference that NULL pointer and thus segfault.

Fix the issue by returning early in both parse_include and
parse_conditional_include in case where the file argument is NULL.
Add a test to avoid future regression.

The issue has been found by the oss-fuzz project, issue 10810.

While our tests in config::include create a plethora of configuration
files, most of them do not get removed at the end of each test. This can
cause weird interactions with tests that are being run at a later stage
if these later tests try to create files or directories with the same
name as any of the created configuration files.

Fix the issue by unlinking all created files at the end of these tests.
In case a configuration includes a key "include.path=" without any
value, the generated configuration entry will have its value set to
`NULL`. This is unexpected by the logic handling includes, and as soon
as we try to calculate the included path we will unconditionally
dereference that `NULL` pointer and thus segfault.

Fix the issue by returning early in both `parse_include` and
`parse_conditional_include` in case where the `file` argument is `NULL`.
Add a test to avoid future regression.

The issue has been found by the oss-fuzz project, issue 10810.
@pks-t pks-t merged commit 84d6f43 into libgit2:master Oct 5, 2018
@pks-t pks-t deleted the pks/config-includes-null-deref branch October 5, 2018 17:53
@pks-t
Copy link
Member Author

pks-t commented Oct 5, 2018

This has been released as part of v0.26.7 and v0.27.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant