-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed DNS::Compress decoding 0xc1 error problem.
- Loading branch information
Showing
6 changed files
with
79 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
require "../src/dns.cr" | ||
|
||
# Oct, 11, 2023 | ||
# Fixed DNS::Compress decoding 0xc1 error problem. | ||
# Before: (((pointer_value - 0b11000000).to_u8 << 8_u8) | pointer_slice[0_u8]).to_u16 | ||
# After: (((pointer_value & 0b00000011_u8).to_u16 << 8_u8) | pointer_slice[0_u8]) | ||
|
||
buffer = "\xd3\xf5\x81\x80\x00\x01\x00\x01\x00\x08\x00\x09\x03\x72\x61\x77" \ | ||
"\x11\x67\x69\x74\x68\x75\x62\x75\x73\x65\x72\x63\x6f\x6e\x74\x65" \ | ||
"\x6e\x74\x03\x63\x6f\x6d\x00\x00\x1c\x00\x01\xc0\x0c\x00\x1c\x00" \ | ||
"\x01\x00\x00\x00\x99\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00" \ | ||
"\x00\x00\x00\x00\x00\x00\x00\xc0\x10\x00\x02\x00\x01\x00\x01\x32" \ | ||
"\xcf\x00\x14\x04\x64\x6e\x73\x32\x03\x70\x30\x31\x05\x6e\x73\x6f" \ | ||
"\x6e\x65\x03\x6e\x65\x74\x00\xc0\x10\x00\x02\x00\x01\x00\x01\x32" \ | ||
"\xcf\x00\x13\x06\x6e\x73\x2d\x31\x38\x31\x09\x61\x77\x73\x64\x6e" \ | ||
"\x73\x2d\x32\x32\xc0\x22\xc0\x10\x00\x02\x00\x01\x00\x01\x32\xcf" \ | ||
"\x00\x19\x07\x6e\x73\x2d\x31\x38\x36\x37\x09\x61\x77\x73\x64\x6e" \ | ||
"\x73\x2d\x34\x31\x02\x63\x6f\x02\x75\x6b\x00\xc0\x10\x00\x02\x00" \ | ||
"\x01\x00\x01\x32\xcf\x00\x13\x06\x6e\x73\x2d\x35\x39\x36\x09\x61" \ | ||
"\x77\x73\x64\x6e\x73\x2d\x31\x30\xc0\x62\xc0\x10\x00\x02\x00\x01" \ | ||
"\x00\x01\x32\xcf\x00\x07\x04\x64\x6e\x73\x33\xc0\x58\xc0\x10\x00" \ | ||
"\x02\x00\x01\x00\x01\x32\xcf\x00\x07\x04\x64\x6e\x73\x34\xc0\x58" \ | ||
"\xc0\x10\x00\x02\x00\x01\x00\x01\x32\xcf\x00\x07\x04\x64\x6e\x73" \ | ||
"\x31\xc0\x58\xc0\x10\x00\x02\x00\x01\x00\x01\x32\xcf\x00\x17\x07" \ | ||
"\x6e\x73\x2d\x31\x34\x31\x31\x09\x61\x77\x73\x64\x6e\x73\x2d\x34" \ | ||
"\x38\x03\x6f\x72\x67\x00\xc0\x73\x00\x1c\x00\x01\x00\x01\x31\xf8" \ | ||
"\x00\x10\x26\x00\x90\x00\x53\x00\xb5\x00\x00\x00\x00\x00\x00\x00" \ | ||
"\x00\x01\xc0\xb7\x00\x1c\x00\x01\x00\x01\x34\x09\x00\x10\x26\x00" \ | ||
"\x90\x00\x53\x02\x54\x00\x00\x00\x00\x00\x00\x00\x00\x01\xc0\x92" \ | ||
"\x00\x01\x00\x01\x00\x00\x04\x4c\x00\x04\xcd\xfb\xc7\x4b\xc0\x92" \ | ||
"\x00\x1c\x00\x01\x00\x00\x05\xcd\x00\x10\x26\x00\x90\x00\x53\x07" \ | ||
"\x4b\x00\x00\x00\x00\x00\x00\x00\x00\x01\xc1\x0f\x00\x01\x00\x01" \ | ||
"\x00\x00\x06\xeb\x00\x04\xcd\xfb\xc5\x83\xc0\xfc\x00\x01\x00\x01" \ | ||
"\x00\x01\x1b\x9b\x00\x04\xc6\x33\x2c\x01\xc0\xfc\x00\x1c\x00\x01" \ | ||
"\x00\x02\x4a\x57\x00\x10\x26\x20\x00\x4d\x40\x00\x62\x59\x00\x07" \ | ||
"\x00\x01\x00\x00\x00\x01\xc0\x53\x00\x01\x00\x01\x00\x00\x04\xd0" \ | ||
"\x00\x04\xc6\x33\x2d\x01\xc0\x53\x00\x1c\x00\x01\x00\x02\x8c\x99" \ | ||
"\x00\x10\x2a\x00\xed\xc0\x62\x59\x00\x07\x00\x01\x00\x00\x00\x00" \ | ||
"\x00\x02".to_slice | ||
|
||
reply = DNS::Packet.from_io protocol_type: DNS::ProtocolType::UDP, io: IO::Memory.new(buffer) | ||
STDOUT.puts [reply] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters