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

error when decoding compressed domain name #5

Open
jiangzhuti opened this issue Jul 9, 2019 · 3 comments
Open

error when decoding compressed domain name #5

jiangzhuti opened this issue Jul 9, 2019 · 3 comments

Comments

@jiangzhuti
Copy link

RFC 1035 4.1.4 says:

The compression scheme allows a domain name in a message to be represented as either:

  • a sequence of labels ending in a zero octet
  • a pointer
  • a sequence of labels ending with a pointer

so when decoding a dns packet which contains a pointer-ending CNAME at the end, the code runs here: https://github.com/mnezerka/dnslib/blob/master/src/buffer.cpp#L287
saveBuffPos is equal to the buffer's size, then, at line 290 setPos(saveBuffPos);, an exception is thrown.

@mnezerka
Copy link
Owner

mnezerka commented Jul 9, 2019

Hi @jiangzhuti, thank you for all your findings. If you already have a fix, don't hesitate to come with PR. I'll appreciate it since I'm no longer working in area of telecommunication test automation and it will definitely take some time to refresh my knowledge of those RFCs and fix it properly.

@jiangzhuti
Copy link
Author

Hi @jiangzhuti, thank you for all your findings. If you already have a fix, don't hesitate to come with PR. I'll appreciate it since I'm no longer working in area of telecommunication test automation and it will definitely take some time to refresh my knowledge of those RFCs and fix it properly.

ok, I will try. This is an interesting project.

This was referenced Jan 13, 2023
@mnezerka
Copy link
Owner

To be able to validate your PRs and decision to change setPos(), would it be possible to share an example of call which is causing problems? I mean - fragment of code (or unit test) that fails for your "pointer-ending CNAME" packet? I could spend some time to thing about this case and see the execution flow. Allowing of buffer to point at byte which doesn't belong to it is something I'm trying to avoid. May be, there is a different approach to solve this issue - e.g. check if buffer is full or something similar.

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 a pull request may close this issue.

2 participants