mirror of
https://github.com/systemd/systemd.git
synced 2024-10-27 10:25:37 +03:00
resolved: tests for dns_packet_extract(); check handling of self-referential compression pointers
This commit is contained in:
parent
f97d7a6969
commit
326ba6a5b0
@ -935,6 +935,30 @@ TEST(packet_query_bad_compression_5) {
|
||||
ASSERT_EQ(dns_answer_size(packet->answer), 0u);
|
||||
}
|
||||
|
||||
TEST(packet_query_bad_compression_6) {
|
||||
_cleanup_(dns_packet_unrefp) DnsPacket *packet = NULL;
|
||||
|
||||
ASSERT_OK(dns_packet_new(&packet, DNS_PROTOCOL_DNS, 0, DNS_PACKET_SIZE_MAX));
|
||||
ASSERT_NOT_NULL(packet);
|
||||
dns_packet_truncate(packet, 0);
|
||||
|
||||
const uint8_t data[] = {
|
||||
0x00, 0x2a, 0x01, 0x00,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
/* name */ 0x03, 'w', 'w', 'w',
|
||||
0xc0, 0x0c, /* points at the current name */
|
||||
/* A */ 0x00, 0x01,
|
||||
/* IN */ 0x00, 0x01
|
||||
};
|
||||
|
||||
ASSERT_OK(dns_packet_append_blob(packet, data, sizeof(data), NULL));
|
||||
|
||||
ASSERT_ERROR(dns_packet_extract(packet), EBADMSG);
|
||||
ASSERT_EQ(dns_question_size(packet->question), 0u);
|
||||
ASSERT_EQ(dns_answer_size(packet->answer), 0u);
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
* reply: A
|
||||
* ================================================================ */
|
||||
|
Loading…
Reference in New Issue
Block a user