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

Fix a possible segfault in heim::net::nic() for Windows #336

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

daladim
Copy link
Contributor

@daladim daladim commented Jun 25, 2021

Hello,

After some time using heim::net::nic() on Windows (which I implemented some time ago in ad69138), I realized I introduced a potential null pointer dereferencing 😨

I've actually ran into this in some tests of mine, that segfaulted when an adapter had not been assigned any IP address.

This MR fixes this issue by properly checking for null pointers where I had forgotten to do so.
Luckily, this bug has never reached a tagged version nor a published version of the heim crate in crates.io

@daladim daladim force-pushed the nic_segfault branch 2 times, most recently from b51ce33 to d5f2258 Compare June 25, 2021 08:59
A null pointer here means "no interface", not an error.
An error is signalled by res != NO_ERROR
@daladim daladim force-pushed the nic_segfault branch 4 times, most recently from 9fcdfc5 to 9145064 Compare June 25, 2021 09:37
@coveralls
Copy link

coveralls commented Jun 25, 2021

Coverage Status

Coverage increased (+0.3%) to 46.429% when pulling 4adea5c on daladim:nic_segfault into b292f15 on heim-rs:master.

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