Fix NPE in SimpleResolver by PhroZenOne · Pull Request #277 · dnsjava/dnsjava · GitHub
Skip to content

Fix NPE in SimpleResolver#277

Merged
ibauersachs merged 1 commit into
dnsjava:masterfrom
PhroZenOne:master
Feb 5, 2023
Merged

Fix NPE in SimpleResolver#277
ibauersachs merged 1 commit into
dnsjava:masterfrom
PhroZenOne:master

Conversation

@PhroZenOne

Copy link
Copy Markdown
Contributor

When reading a response that is REFUSED with no more data. The code could crash while comparing the DNS query with the response.

This change skips the comparison if the response is denied.

@codecov-commenter

Copy link
Copy Markdown

@ibauersachs

Copy link
Copy Markdown
Member

Hi, thanks for your contribution!

I'm very hesitant to accept this as is, as I'm currently considering the answer you received from the server is invalid. Specifically, the DNS specification requires the validation on all of id/name/class/type (see RFC 5452, 9.1). However, you're right that the missing name shouldn't cause a NPE: the response from SimpleResolver (and for that matter, the other implementations too) should be failed otherwise.

Can you please share some details about the setup where you got this, especially the name and version of the server?

When reading a response that is REFUSED with no more data. The code could crash while comparing the DNS query with the response.

This change skips the comparison if the response is denied.
@PhroZenOne

Copy link
Copy Markdown
Contributor Author

The DNS server is something I'm accessing as a third party so I have no info about the server itself. I have notified them and hope that they fix stuff on their side.

However, I changed the fix to throw an WireParseException instead. Only issue I have with this solution is that the DENIED flag might be a good indicator on what is wrong and that is hidden right now.

Maybe returning the message with the exception is a solution?

@PhroZenOne

Copy link
Copy Markdown
Contributor Author

@ibauersachs have you had time to think about this? :)

@ibauersachs

Copy link
Copy Markdown
Member

No, not yet. I'll might get to it on Sunday, but I can't make any promises.

@ibauersachs ibauersachs merged commit bd5177d into dnsjava:master Feb 5, 2023
@ibauersachs

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants