Properly handle empty proxy ignore entry#303
Merged
janbrummer merged 3 commits intolibproxy:mainfrom Jul 5, 2024
Merged
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #303 +/- ##
=======================================
Coverage 69.13% 69.13%
=======================================
Files 18 18
Lines 878 878
Branches 258 258
=======================================
Hits 607 607
Misses 164 164
Partials 107 107 ☔ View full report in Codecov by Sentry. |
janbrummer
reviewed
Jul 5, 2024
Contributor
|
Thanks! |
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.
The crash reported in #299 is not due to
ignorebeing NULL, but it being an empty string. This can easily happen, as at least some backends create the list of "ignores" by callingstrspliton a delimited string. If there's a stray delimiter character in that string, the resulting vector will contain empty strings.In
ignore_domain,g_strsplitis then called (to separate port from hostname) on an empty string.g_strsplithas a quirk: if called on an empty string, it returns an empty array.Then
ignore_hostis set to the first entry in that (empty) array, which will make it a NULL pointer.Then
strlenis called onignore_host, causing the access violation and a crash.This crash can be reproduced on Windows with libproxy 0.5.7 by setting the ProxyOverride registry value to
;(single semicolon). It's likely reproducible with other backends as well (the original report was with Gnome)