Skip to content

Commit

Permalink
[fix] Fixed a DNS record encoding bug from the last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pajama-coder committed Jul 31, 2024
1 parent e4404bf commit b820bc4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api/dns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ static int write_record(pjs::Object *dns, Data::Builder &db) {
if (!utils::get_ip_v4(rdata, ip)) {
throw std::runtime_error("invalid IPv4 notation");
}
skip += push_int16(db, sizeof(ip));
db.push(ip, sizeof(ip));
skip += sizeof(ip);
} else if (type == int(RecordType::TYPE_AAAA)) {
Expand All @@ -776,6 +777,7 @@ static int write_record(pjs::Object *dns, Data::Builder &db) {
if (!utils::get_ip_v6(*rdata, ip)) {
throw std::runtime_error("invalid IPv6 notation");
}
skip += push_int16(db, sizeof(ip));
db.push(ip, sizeof(ip));
skip += sizeof(ip);
} else if (type == int(RecordType::TYPE_SOA)) {
Expand Down

0 comments on commit b820bc4

Please sign in to comment.