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

Prevent reading from a nil response in DNS64 #323

Merged
merged 1 commit into from
Mar 20, 2023

Conversation

EkilDeew
Copy link
Contributor

@EkilDeew EkilDeew commented Mar 16, 2023

Sometimes if the upstream failed to be contacted, the return response will be empty.
DNSCrypts still wants to read the response code. This causes a panic if DNS64 is configured.

@ameshkov ameshkov requested a review from EugeneOne1 March 18, 2023 14:28
@EugeneOne1
Copy link
Member

@EkilDeew, hello and thanks for the contribution.

The fix is rather simple, but I presume there is a better place for the introduced check. The documentation of checkDNS64 function states both the request and response are required to be non-nil, so I propose to move the check to the only place this function called from – the performDNS64 function, right above the call itself. Perhaps, it even makes sense to check the request for nilness as well.

Copy link
Member

@EugeneOne1 EugeneOne1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EkilDeew
Copy link
Contributor Author

I've added the check in performDNS64.
However I've only added the response check, because this was the nil object.
The request object should always be non-nil, and if not should crash in developpement because if would likely be a dnsproxy error rather than an third party induced error (as the error in this PR was).

@EkilDeew EkilDeew requested a review from EugeneOne1 March 19, 2023 13:28
@adguard adguard merged commit 4baff8f into AdguardTeam:master Mar 20, 2023
@EugeneOne1
Copy link
Member

@EkilDeew, it's all right now, we've merged that. Thanks again for the contribution.

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.

3 participants