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 DNS decompression bug and add descriptive exceptions #444

Merged
merged 4 commits into from
Jun 9, 2021

Conversation

gaya-cohen
Copy link
Contributor

Copy link
Owner

@mfontanini mfontanini left a comment

Choose a reason for hiding this comment

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

A couple of small comments, looks good otherwise!

/**
* \brief Exception thrown when a DNS decompression pointer is out of bounds.
*/
class DNS_decompression_pointer_out_of_bounds : public exception_base {
Copy link
Owner

Choose a reason for hiding this comment

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

Creating a new exception is fine for this case but we should make it derive from malformed_packet. Otherwise people catching malformed_packet when parsing a DNS packet will now be surprised that their catch no longer traps the exception after they upgrade their version of libtins.

On a side note, can you rename these so DNS is lowercase? e.g. dns_decompression_pointer_out_of_bounds. The rest of the exceptions don't capitalize any words (e.g. pdu_not_found) so we should keep names consistent.

*/
class DNS_decompression_pointer_out_of_bounds : public exception_base {
public:
DNS_decompression_pointer_out_of_bounds() : exception_base("DNS decompression pointer out of bounds") { }
Copy link
Owner

Choose a reason for hiding this comment

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

nit: maybe add a colon after "decompression"? e.g. "DNS decompression: pointer out of bounds". Same for the other exception.

@gaya-cohen gaya-cohen force-pushed the decompression-bug-fix branch 2 times, most recently from e4ddd05 to 1650b60 Compare June 9, 2021 08:36
@gaya-cohen gaya-cohen requested a review from mfontanini June 9, 2021 14:00
@mfontanini
Copy link
Owner

Thanks!

@mfontanini mfontanini merged commit 14bb185 into mfontanini:master Jun 9, 2021
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