Skip to content

Commit c5a06db

Browse files
committed
- qdns: avoid warning about unaligned &src.port access inside packed struct
1 parent 4649c56 commit c5a06db

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

qdns.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ int qdns::parse_zone(const string &file)
472472
m->rra_count = 0;
473473
}
474474

475+
uint16_t prt = 0;
475476

476477
switch (ntohs(dtype)) {
477478
case dns_type::A:
@@ -623,8 +624,12 @@ int qdns::parse_zone(const string &file)
623624
break;
624625
case dns_type::SRV:
625626
m->type = dtype;
626-
if (sscanf(field, "%255[^:]:%hu:%hu:%hu", name, &prio, &weight, &srv.port) != 4)
627+
628+
// avoid warning about unaligned &src.port access
629+
if (sscanf(field, "%255[^:]:%hu:%hu:%hu", name, &prio, &weight, &prt) != 4)
627630
continue;
631+
srv.port = prt;
632+
628633
if (host2qname(name, dname) <= 0)
629634
continue;
630635
if (dname.size() > 255)

0 commit comments

Comments
 (0)