Skip to content

Properly handle empty proxy ignore entry#303

Merged
janbrummer merged 3 commits intolibproxy:mainfrom
davids-work:fix-strlen-null
Jul 5, 2024
Merged

Properly handle empty proxy ignore entry#303
janbrummer merged 3 commits intolibproxy:mainfrom
davids-work:fix-strlen-null

Conversation

@davids-work
Copy link
Copy Markdown
Contributor

The crash reported in #299 is not due to ignore being NULL, but it being an empty string. This can easily happen, as at least some backends create the list of "ignores" by calling strsplit on a delimited string. If there's a stray delimiter character in that string, the resulting vector will contain empty strings.

In ignore_domain, g_strsplit is then called (to separate port from hostname) on an empty string. g_strsplit has a quirk: if called on an empty string, it returns an empty array.

Then ignore_host is set to the first entry in that (empty) array, which will make it a NULL pointer.

Then strlen is called on ignore_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)

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 4, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 69.13%. Comparing base (c005029) to head (76d7f83).

Files Patch % Lines
src/backend/px-manager.c 0.00% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

@janbrummer
Copy link
Copy Markdown
Contributor

Thanks!

@janbrummer janbrummer merged commit 18467c0 into libproxy:main Jul 5, 2024
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.

2 participants