diff options
Diffstat (limited to '')
-rw-r--r-- | dnscrypt.cc | 7 |
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; |