-
Notifications
You must be signed in to change notification settings - Fork 382
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
Fix DNS decompression bug and add descriptive exceptions #444
Conversation
There was a problem hiding this 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!
include/tins/exceptions.h
Outdated
/** | ||
* \brief Exception thrown when a DNS decompression pointer is out of bounds. | ||
*/ | ||
class DNS_decompression_pointer_out_of_bounds : public exception_base { |
There was a problem hiding this comment.
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.
include/tins/exceptions.h
Outdated
*/ | ||
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") { } |
There was a problem hiding this comment.
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.
e4ddd05
to
1650b60
Compare
Thanks! |
#443