summaryrefslogtreecommitdiffstats
path: root/dnscrypt.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 21:14:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 21:14:48 +0000
commite10ff189aca57bba91933088195d4edda199cb20 (patch)
tree056237559582eba27e68fa864434436ac5b7f535 /dnscrypt.cc
parentAdding upstream version 1.8.3. (diff)
downloaddnsdist-e10ff189aca57bba91933088195d4edda199cb20.tar.xz
dnsdist-e10ff189aca57bba91933088195d4edda199cb20.zip
Adding upstream version 1.9.3.upstream/1.9.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--dnscrypt.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/dnscrypt.cc b/dnscrypt.cc
index 6db8613..9be46d7 100644
--- a/dnscrypt.cc
+++ b/dnscrypt.cc
@@ -399,9 +399,10 @@ bool DNSCryptQuery::parsePlaintextQuery(const PacketBuffer& packet)
return false;
}
- const struct dnsheader * dh = reinterpret_cast<const struct dnsheader *>(packet.data());
- if (dh->qr || ntohs(dh->qdcount) != 1 || dh->ancount != 0 || dh->nscount != 0 || dh->opcode != Opcode::Query)
+ const dnsheader_aligned dh(packet.data());
+ if (dh->qr || ntohs(dh->qdcount) != 1 || dh->ancount != 0 || dh->nscount != 0 || static_cast<uint8_t>(dh->opcode) != Opcode::Query) {
return false;
+ }
unsigned int qnameWireLength;
uint16_t qtype, qclass;
@@ -418,7 +419,7 @@ bool DNSCryptQuery::parsePlaintextQuery(const PacketBuffer& packet)
return false;
}
- d_qname = qname;
+ d_qname = std::move(qname);
d_id = dh->id;
d_valid = true;